[PATCH] D124607: Add an error message to the default SIGPIPE handler
James Henderson via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu May 5 04:45:07 PDT 2022
jhenderson added a comment.
I'm wondering if it would be better to use python to drive this test rather than a Unix-only shell script? I'm mostly concerned about the potential flakiness of the `sleep 2` command, since on an overloaded system, it's possible this won't have the desired effect. If you use python, you could attach a reader to the stdout of the llvm-nm process, that only read a bit of output (e.g. 1 byte) before stopping and closing itself. This in turn should trigger the error on stderr, if I'm following the behaviour right.
Here's about what I'm thinking (make sure to check this works before using):
# RUN: not %python %s llvm-nm 2>&1 | FIleCheck %s
# CHECK: write on a pipe with no reader
import subprocess
import sys
with subprocess.Popen([sys.argv[1]], stdout=subprocess.PIPE) as process:
process.stdout.read(1)
process.stdout.close()
sys.exit(process.returncode)
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D124607/new/
https://reviews.llvm.org/D124607
More information about the llvm-commits
mailing list