Skip to content
Better HN
Top
New
Best
Ask
Show
Jobs
Search
⌘K
undefined | Better HN
0 points
mr_mitm
1y ago
0 comments
Share
How could curl detect where it's piped to?
0 comments
default
newest
oldest
take-five
1y ago
Something like (in Python)
os.isatty(sys.stdout.fileno())
Zambyte
1y ago
That doesn't say where it's piped though. It could be redirected to a file, or piped to something harmless like jq.
timando
1y ago
Iterate through /proc/<pid>/fd and check for the pipe id in the symlink target.
j
/
k
navigate · click thread line to collapse