File tree Expand file tree Collapse file tree
brush-shell/tests/cases/compat Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -724,8 +724,9 @@ pub(crate) async fn invoke_shell_function(
724724 ) ?;
725725
726726 // A function executes within the current shell process and shares its caller's open files,
727- // so the parameters are passed through by shared reference rather than cloned. The shared
728- // borrow also guarantees the body cannot disturb the caller's open-file table.
727+ // so the parameters are passed through by shared reference rather than cloned. This prevents
728+ // direct mutation of the caller's `ExecutionParameters` open-file table, though the function
729+ // may still change the shell's persistent open files via builtins (e.g. `exec`).
729730 let result = body. execute ( context. shell , & context. params ) . await ;
730731
731732 // We've come back out, reflect it.
Original file line number Diff line number Diff line change @@ -1777,7 +1777,7 @@ pub(crate) async fn setup_redirect(
17771777 . parse :: < ShellFd > ( )
17781778 . map_err ( |_| error:: ErrorKind :: InvalidRedirection ) ?;
17791779
1780- // Duplicate the fd .
1780+ // Reference the same open file as the source fd (shared handle; no OS-level duplication) .
17811781 let Some ( target_file) = params. try_fd ( shell, source_fd_num) else {
17821782 return Err ( error:: ErrorKind :: BadFileDescriptor ( source_fd_num) . into ( ) ) ;
17831783 } ;
Original file line number Diff line number Diff line change 2525 args :
2626 - " -c"
2727 - |
28- ulimit -n 256
28+ ulimit -n 256 || exit 1
2929 emit() {
3030 local v
3131 v=$(echo "$1")
4141 args :
4242 - " -c"
4343 - |
44- ulimit -n 256
44+ ulimit -n 256 || exit 1
4545 work() {
4646 local v
4747 v=$(echo "alias-$1" 2>/dev/null)
5757 args :
5858 - " -c"
5959 - |
60- ulimit -n 256
60+ ulimit -n 256 || exit 1
6161 rec() {
6262 local n=$1
6363 if [ "$n" -le 0 ]; then
You can’t perform that action at this time.
0 commit comments