eidheim / tiny-process-library

A small platform independent library making it simple to create and stop new processes in C++, as well as writing to stdin and reading from stdout and stderr of a new process
MIT License
338 stars 73 forks source link

CloseHandle called on invalid handles #29

Closed 5cript closed 6 years ago

5cript commented 6 years ago

https://github.com/eidheim/tiny-process-library/blob/a034812647a89e924c9114db9f2d4c89c70226d1/process_win.cpp#L110-L111

These handles are invalid here and should not be closed. This will overwrite "GetLastError" with 6 = "Invalid Handle", so reading the error value to see what went wrong becomes impossible.

eidheim commented 6 years ago

Thank you for reporting this. Fixed as you proposed in the above commit.