msys2.github.io
msys2.github.io copied to clipboard
Documentation request: porting fork+exec sequence to MinGW
porting fork+exec sequence to MinGW, maybe at least one example how to replace it to smth.
I mean what should be written "instead of" fork+exec
I want to achieve (for bmake porting):
- I want to exec bash command similar way as https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/spawnvpe-wspawnvpe?view=vs-2019
- BUT: I need all output to stdout will go in pipe or buffer, as in https://docs.microsoft.com/en-us/previous-versions/96ayss4b(v%3Dvs.140) How I can achieve it? (why? I need to parse some bash commands output from *.mk files... something as uname, etc) _popen can't provide same environment :( and requires launching smth through cmd.exe
If I just want to exec bash command, _spawnvpe() works. But it just put all output in same stdout, nothing more.
Are you familiar with another command that might already be ported to mingw that uses a similar fork+exec? You might be able to track down the ported code.
@NetMage I think solution for such common problems should be described in wiki with example...