Closed grasmanek94 closed 7 years ago
Thank you, but are you sure there are process output when the process cannot be created? Or if there should be process output if the process cannot be created? Unless I'm mistaken, the current behaviour is correct, but feel free argue against me on this:)
Oh, Unix-like systems seems to output wrong commands when using sh -c
. This seems to be a Windows issue. Feel free to look around for a solution. The problem is that bSuccess is true (if on MSYS2) but no output is sent through the pipe it seems.
edit: this worked in MSYS2, disregard my above comment.
If the process is created through sh -c
, sh
will output an error message if the process cannot be created due to for instance missing/incorrect executable. However, if sh -c
is not used, there will be no output to stdout or stderr at all, and this is working as intended.
If this is intended then please do see this this report as 'never submitted' :) I
I would expect there to be some output like "command doesn't exist", I actually got output on linux when a binary isn't executable (permission error) so I would expect some of the same behavior for other platforms when the executable can't be invoked / doesn't have output on its own. I do understand that not every behavior can be captured in a cross-plaform-friendly way, then those small differences at least do belong in the documentation, right? I was genuinely confused for a second when I got output on linux but not on my windows machine (later I found out the binaries were just missing, and some weren't executable).
The command does not exist
message also is output when using MSYS2 since it's using sh -c
, and you can probably get a similar message on Windows outside MSYS2, but you would have to start the process with cmd /C
(see https://github.com/eidheim/tiny-process-library/blob/master/examples.cpp#L120). cmd
would then output this error message, but bear in mind that I did not create the cmd
examples and have not tried this library outside MSYS2 on Windows.
Sorry for the confusion, but the difference in Windows and Posix process creation is significant. It is manageable though when working within MSYS2 since you have access to the sh
command and other commands typically found on a Posix system.
Tested on: Windows 7 Description: Cannot get process output when process cannot be created (or process didn't run "succesfully") Code:
Identified cause in source code (process_win.cpp:106):
Suggested fix:
Fire the lambda's with captured output either way (even if bSuccess == false). It's the callers responsibility to check the exit code anyway, and a separate "binary doesn't exist" code can be emitted.