redirection of stdout in subjob
sdirkse67 opened this issue · 2 comments
I have a failure in a process that is started via process$new('dumper',stdout='|')
that only happens with stdout sent to a pipe. If I take off the stdout
arg things work OK. Perhaps this is an issue with processx that can be addressed. Or perhaps I am doing something wrong with my dumper code. Any insights or help appreciated.
The executable dumper.exe
calls a windows batch file dd.cmd
, and the batch file redirects stdout to a file. Calling dumper.exe
from a Windows command prompt works, but calling it as below fails:
p = process$new('dumper',stdout='|')
p$read_output()
[1] "dumper: inheritHandles=0 useStdHandles=0 \r\n exitcode: 1 \r\n"
The redirection inside the cmd file fails: this is reflected in the exitcode of 1. If I adjust dumper.c to run with inheritHandles=TRUE and leave the USESTDHANDLES bit alone, it works as hoped. But for other reasons we want to run with inheritHandles=FALSE.
The content of dd.cmd:
@echo off
echo DD %1 %2 > dd.txt
I think this is all expected. processx sets the stdout of dumper
, but if you want to start another process and receive the output of that, then that process will have to inherit stdout. I don't think processx can do anything about this.
But please tell me if I am missing something.