I have a command that I'm calling from code:
which is an executable program that my code communicates with via stdin, stdout and stderr. This works fine, not a single problem.
I want to change this so I can set resource limits on
generate. So I've tried calling:
ulimit -t 1 && generate
But I get a broken pipe when I try to communicate with it.
So I put the line above in a shell script
#!/bin/bash ulimit -t 1 && generate
And I get a broken pipe when I try to communicate with it.
$ echo "foo" | generate_wrapper $ echo "foo" | generate
both give me the correct, identical output. I figured it might be the &&, so I tried just the bare command:
But it still works from the CL, and I still get a broken pipe when I try to communicate with it from code.
I tried to explicitly route the fds, and got:
#!/bin/bash generate >&1 2>&2 <&0
But no, I still get a broken pipe when I try to communicate with it from code.
So obviously I haven't a clue what I'm doing. Can you help? How do I write a wrapper so I can
ulimit a spawned subprocess (
rlimit isn't available for pids in my host language) and still communicate with it?