I want to pipe the output of a script to a different program. Something I would normally do using these two forms:
python test.py 2>&1 | pyrg
python test.py |& pyrg
My problem is that it doesn't work from inside a makefile:
[Makefile]
test:
python test.py 2>&1 | pyrg [doesn't work]
I wish to avoid writing a script file that does the work.
Edit:
This seems like a pyrg
issue:
python test.py 2>&1 | tee test.out // Writes to the file both stderr and stdout
cat test.out | pyrg // Works fine!
python test.py 2>&1 | pyrg // pyrg behaves as if it got no input
This is a bad solution for me as I never get to the cat
part in case of a test failure (everything is inside a Makefile rule)
make
passes the entire line to/bin/sh
for interpretation, so anything that this shell (which does not need to be your user shell) can understand works. – Myrillaexport SHELL := /bin/bash
somewhere in your makefile. – Dextroglucosestdin
. And it actually runs before the first one. Using||
instead of|
maintains the order but yet againpyrg
doesn't get the input. – Bye|&
. But it still behaves as in my previous comment. – Byestdin
(forpyrg
the help text). So it seems they are not connected by the pipe. Only then I see the first program's output on the screen (should have been redirected to the second) – Bye|&
is csh syntax, I wouldn't expect that to work in a makefile. Are you sure there isn't a typo, like puttingpython test.py 2&>1 | pyrg
? is there now a file1
in your working directory? – Suave1
file (unless I intentionally make the typo :) ) – Byepyrg <(python test.py 2>&1)
? – Realtor