Closed ianthehenry closed 1 year ago
I thought this should work, seems like a bug potentially if it doesn't.
I would also try swapping the stderr and stdout - I think its slightly counter intuitive - its essentially equivalent to a call to dup2 iirc.
Yeah, swapping doesn't seem to make a difference:
repl:2:> ($< sh -c `echo hi >&2` > [stdout stderr])
hi
""
repl:3:> ($< sh -c `echo hi >&2` > [stderr stdout])
hi
""
So the redirect was working correctly, and using sh/$
for example gave the correct behavior. The problem was that the implicit dup2
done by $<
happens after this, so for a brief time stderr and stdout do refer to the same file, but the second call to dup2
causes stdout to point elsewhere. If I'm understanding this right. This appears to be easily fixed by #19.
I would expect this to work, but it doesn't:
(I know I can capture stderr by redirecting it to a buffer -- the
$<
is just to demonstrate that it didn't actually do the thing.)Is there a way to redirect stderr to stdout?