Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reader never reaches EOF #3

Open
Naatan opened this issue Aug 31, 2023 · 3 comments
Open

Reader never reaches EOF #3

Naatan opened this issue Aug 31, 2023 · 3 comments

Comments

@Naatan
Copy link

Naatan commented Aug 31, 2023

I ran into this issue while debugging #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.

Naatan added a commit to ActiveState/termtest that referenced this issue Sep 1, 2023
@photostorm
Copy link
Owner

I can seen why the reader never reaches EOF. I added some code that handle that for now.

@Naatan
Copy link
Author

Naatan commented Sep 7, 2023

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:

ActiveState/termtest@d5396a3#diff-bd6e81b6b57a17fd2e3e07aafc51b46e56f5478e3225c19aa6567394d3df600fR38

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.

@photostorm
Copy link
Owner

photostorm commented Sep 8, 2023

I just did a quick fix. I plan out how I want to handle it correctly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants