Merge pull request #2322 from senhuang42/guard_against_stdin_for_warning_prompts
Don't let warning messages consume input from stdin
This commit is contained in:
@@ -310,6 +310,23 @@ test -f precompressedFilterTestDir/input.6.zst.zst
|
||||
println "Test completed"
|
||||
|
||||
|
||||
|
||||
println "\n===> warning prompts should not occur if stdin is an input"
|
||||
println "y" > tmpPrompt
|
||||
println "hello world" >> tmpPrompt
|
||||
zstd tmpPrompt -f
|
||||
zstd < tmpPrompt -o tmpPrompt.zst && die "should have aborted immediately and failed to overwrite"
|
||||
zstd < tmpPrompt -o tmpPrompt.zst -f # should successfully overwrite with -f
|
||||
zstd -q -d -f tmpPrompt.zst -o tmpPromptRegenerated
|
||||
$DIFF tmpPromptRegenerated tmpPrompt # the first 'y' character should not be swallowed
|
||||
|
||||
echo 'yes' | zstd tmpPrompt -o tmpPrompt.zst # accept piped "y" input to force overwrite when using files
|
||||
echo 'yes' | zstd < tmpPrompt -o tmpPrompt.zst && die "should have aborted immediately and failed to overwrite"
|
||||
zstd tmpPrompt - < tmpPrompt -o tmpPromp.zst --rm && die "should have aborted immediately and failed to remove"
|
||||
|
||||
println "Test completed"
|
||||
|
||||
|
||||
println "\n===> recursive mode test "
|
||||
# combination of -r with empty list of input file
|
||||
zstd -c -r < tmp > tmp.zst
|
||||
|
||||
Reference in New Issue
Block a user