Open Naatan opened 1 year ago
I can seen why the reader never reaches EOF. I added some code that handle that for now.
I just tried out this most recent change, and while it does indeed exit now, it seems the resulting ProcessState of the linked process is no longer accurate. The exit code appears to always be -1.
Additionally, the change you pushed seems to ignore errors with process closing, which is a little concerning, but I also don't know the details on the rationale.
For what it's worth, this is the workaround I used:
I didn't dig into the details as this is only meant as a temporary workaround, but it appears that if I use the built-in process package it always thinks the process is running, whereas gopsutil is able to correctly infer that the process has exited.
I just did a quick fix. I plan out how I want to handle it correctly.
I ran into this issue while debugging https://github.com/photostorm/pty/issues/2
When you run the test I shared there (https://github.com/ActiveState/termtest/blob/a695852f3f6479d5fbed93abd19562525c4045cf/test/pty/pty_test.go) - you'll find that it never exits, and just hangs on read.
On Linux and Mac the reader will reach EOF once the process has stopped, but on Windows this doesn't seem to happen.