-
Notifications
You must be signed in to change notification settings - Fork 25
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
should wslbridge2 return child exit status? #28
Comments
I have added something for this. Would you like to check it? I have not properly though about the propagation of exit status to frontend. |
I guess the exit status was unreliable because of a race condition with the previous wait wslbridge2/src/wslbridge2-backend.cpp Line 306 in e4b44dd
I have the full propagation working in my fork https://github.com/iuliantatarascu/wslbridge2/commit/626aa01765d408d365529c27e552760a886e9d02 I don't know what scenarios to test, to make sure I didn't break other things. |
It returns the child's actual exit code on successful execution, and -1 if any other error occurs along the way. I have only tested with WSL1, I don't know about WSL2, things might be different there. |
BTW, in your same code the exit status is messed up. If GetExitCodeProcess() is added in the watchdog thread then it will capture the return value of wsl.exe process NOT the exit status of child process of wslbridge2-backend. The proper way is to send the exit status through socket. See wslbridge project, parent of this one. |
Now that mintty/wsltty#254 is fixed, should
wslbridge2
propagate the backend/child exit status, as suggested in this comment mintty/wsltty#254 (comment)?This would allow
mintty --hold error
fromwsltty
to close the window upon a successful command, and hold the window open if the command returns non-zero exit code.I tried implementing it like this:
diff, CLICK ME
But it doesn't seem to always work. Running
./bin/wslbridge2.exe /bin/false
should always return 1. The proper exit code fromwait()
is not always captured, sometimesWEXITSTATUS
wrongly gives 0, sometimes it correctly gives the real status code from the child.wslbridge2 version
e4b44dd236c587613e461d56011016292051d05d
The text was updated successfully, but these errors were encountered: