On Tue, Oct 18, 2016 at 12:47 PM, Justin M. Keyes <
just...@gmail.com> wrote:
> I'm trying to confirm whether I'm doing something wrong or I'm running
> into a limitation. I want to spawn arbitrary shell commands and send
> input / capture output.
>
> The typical uv_spawn example (code below) works fine for
> non-backgrounded shell commands like these:
> bash -c 'tee'
> bash -c 'cat -'
>
> but "backgrounded" shell commands do not capture input:
> bash -c 'tee &'
> bash -c 'cat - &'
>
> For example, when the sample code below is modified with:
> args[2] = "cat - &";
> and invoked with:
> $ echo foo | ./a.out
> then "foo" is not printed.
>
> Although intuitively it seems like this "should not" work, the reason
> I bothered to ask is that the following *does* work:
> args[2] = "echo foo &";
> invoked with:
> $ ./a.out
> prints "foo". Here the "backgrounded" output was captured by libuv.
> But in the cases above, input does not reach the backgrounded process.
Gah, I had tunnel-vision here. Of course, these invocations behave the
Justin M. Keyes