From 4bc9e5c6ab5f9c0980f0dbd6606380198f13277b Mon Sep 17 00:00:00 2001 From: John Hood Date: Sun, 6 Nov 2016 01:13:36 -0400 Subject: [PATCH] Handle printing to closed pipes better in tests. Some systems do not deliver SIGPIPE to shell pipeline writers when the downstream reader has exited. So, also check for errors from /bin/printf. I fixed this for OpenBSD 6.0 but I think it will also fix posh on Linux. --- src/tests/prediction-unicode.test | 4 ++-- src/tests/pty-deadlock.test | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/tests/prediction-unicode.test b/src/tests/prediction-unicode.test index 90d382c..839d609 100755 --- a/src/tests/prediction-unicode.test +++ b/src/tests/prediction-unicode.test @@ -52,8 +52,8 @@ tmux_commands() sleep 1 printf "send-keys 0x04\n" # This will get killed by SIGPIPE. - while sleep 1; do - printf "show-options\n" + while printf "show-options\n"; do + sleep 1 done } diff --git a/src/tests/pty-deadlock.test b/src/tests/pty-deadlock.test index 8b014c0..a28216e 100755 --- a/src/tests/pty-deadlock.test +++ b/src/tests/pty-deadlock.test @@ -36,8 +36,8 @@ tmux_commands() # And stop the test script, so it produces its exit messge. printf "send-keys 0x0d\n" # This will get killed by SIGPIPE. - while sleep 1; do - printf "show-options\n" + while printf "show-options\n"; do + sleep 1 done }