mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-02-21 08:10:24 +08:00
tests/noshebang: Sleep before executing a file we just wrote to
When you try to execute a file directly after you've written to it, you might, on some systems, get a "text file busy" error. So we unfortunately have to sleep to avoid it. See #8021 for where this was added, 537b3f6cb1c032c992de16991a01e99a06f5e4bb for the same problem.
This commit is contained in:
parent
34ededa644
commit
7511de8d8d
@ -24,6 +24,7 @@ end
|
||||
|
||||
# Empty executable files are 'true'.
|
||||
true >file
|
||||
sleep 0.1
|
||||
runfile
|
||||
#CHECK: 0
|
||||
#CHECK: 0
|
||||
@ -36,6 +37,7 @@ runfile
|
||||
|
||||
# Never implicitly pass files ending with .fish to /bin/sh.
|
||||
true >file.fish
|
||||
sleep 0.1
|
||||
chmod a+x file.fish
|
||||
set -g fish_use_posix_spawn 0
|
||||
./file.fish
|
||||
@ -58,12 +60,14 @@ rm file.fish
|
||||
# On to NUL bytes.
|
||||
# The heuristic is that there must be a line containing a lowercase letter before the first NUL byte.
|
||||
echo -n -e 'true\n\x00' >file
|
||||
sleep 0.1
|
||||
runfile
|
||||
#CHECK: 0
|
||||
#CHECK: 0
|
||||
|
||||
# Doesn't meet our heuristic as there is no newline.
|
||||
echo -n -e 'true\x00' >file
|
||||
sleep 0.1
|
||||
runfile
|
||||
#CHECK: 126
|
||||
#CHECKERR: Failed {{.*}}
|
||||
@ -77,6 +81,7 @@ runfile
|
||||
|
||||
# Doesn't meet our heuristic as there is no lowercase before newline.
|
||||
echo -n -e 'NOPE\n\x00' >file
|
||||
sleep 0.1
|
||||
runfile
|
||||
#CHECK: 126
|
||||
#CHECKERR: Failed {{.*}}
|
||||
|
Loading…
x
Reference in New Issue
Block a user