mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-14 05:53:59 +00:00
Use head instead of dd in the read test
The read test is now failing on GitHub actions even though it passes on my Mac. It may be due to differences in dd between these two environments. Stop using dd and just use head.
This commit is contained in:
parent
108fe574a0
commit
448dd18685
1 changed files with 3 additions and 5 deletions
|
@ -192,7 +192,7 @@ set line abcdefghijklmnopqrstuvwxyz
|
|||
# Ensure the `read` command terminates if asked to read too much data. The var
|
||||
# should be empty. We throw away any data we read if it exceeds the limit on
|
||||
# what we consider reasonable.
|
||||
yes $line | dd iflag=fullblock bs=1024 count=(math "1 + $fish_read_limit / 1024") 2>/dev/null | read --null x
|
||||
yes $line | head -c (math "1 + $fish_read_limit") | read --null x
|
||||
if test $status -ne 122
|
||||
echo reading too much data did not terminate with failure status
|
||||
end
|
||||
|
@ -239,14 +239,12 @@ end
|
|||
|
||||
# Same as previous test but limit the amount of data fed to `read` rather than
|
||||
# using the `--nchars` flag.
|
||||
yes $line | dd iflag=fullblock bs=1024 count=(math "$fish_read_limit / 1024") 2>/dev/null | read --null x
|
||||
yes $line | head -c $fish_read_limit | read --null x
|
||||
if test $status -ne 0
|
||||
echo the read of the max amount of data failed unexpectedly
|
||||
end
|
||||
if test (string length "$x") -ne $fish_read_limit
|
||||
# See how much data 'yes' produced.
|
||||
set yeslen (yes $line | dd iflag=fullblock bs=1024 count=(math "$fish_read_limit / 1024") 2>/dev/null | wc -c | tr -d " \t\n\r")
|
||||
echo reading the max amount of data with --nchars failed the length test. read: (string length "$x"), limit: $fish_read_limit, yes produced: $yeslen
|
||||
echo reading with a limited amount of input data failed the length test
|
||||
end
|
||||
|
||||
# Confirm reading non-interactively works -- \#4206 regression
|
||||
|
|
Loading…
Reference in a new issue