mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-05-28 09:31:16 -03:00
Correctly cloexec file redirections
The IO cleanup left file redirections open in the child. For example, /bin/cmd < file.txt would redirect stdin but also leave the file open. Ensure these get closed properly.
This commit is contained in:
24
tests/checks/fds.fish
Normal file
24
tests/checks/fds.fish
Normal file
@@ -0,0 +1,24 @@
|
||||
# RUN: %fish -C "set helper %fish_test_helper" %s
|
||||
|
||||
# Check that we don't leave stray FDs.
|
||||
|
||||
$helper print_fds
|
||||
# CHECK: 0 1 2
|
||||
|
||||
$helper print_fds 0>&-
|
||||
# CHECK: 1 2
|
||||
|
||||
$helper print_fds 0>&- 2>&-
|
||||
# CHECK: 1
|
||||
|
||||
false | $helper print_fds 0>&-
|
||||
# CHECK: 0 1 2
|
||||
|
||||
$helper print_fds <(status current-filename)
|
||||
# CHECK: 0 1 2
|
||||
|
||||
$helper print_fds <(status current-filename)
|
||||
# CHECK: 0 1 2
|
||||
|
||||
$helper print_fds 3<(status current-filename)
|
||||
# CHECK: 0 1 2 3
|
||||
Reference in New Issue
Block a user