-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Vendor ConPtySystem #7656
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
base: main
Are you sure you want to change the base?
Vendor ConPtySystem #7656
Conversation
| fn do_kill(&mut self) -> IoResult<()> { | ||
| let proc = self.proc.lock().unwrap().try_clone().unwrap(); | ||
| let res = unsafe { TerminateProcess(proc.as_raw_handle() as _, 1) }; | ||
| let err = IoError::last_os_error(); | ||
| if res != 0 { | ||
| Err(err) | ||
| } else { | ||
| Ok(()) | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Likely out-of-scope, but TerminateProcess’s return code seems backwards?
It should return nonzero on success, but as it stands, the branch returns Err when res != 0 and Ok(()) when res == 0. So do_kill() reports an error when the process is terminated and a success when the termination fails
| fn kill(&mut self) -> IoResult<()> { | ||
| let res = unsafe { TerminateProcess(self.proc.as_raw_handle() as _, 1) }; | ||
| let err = IoError::last_os_error(); | ||
| if res != 0 { | ||
| Err(err) | ||
| } else { | ||
| Ok(()) | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar here
The repo we were depending on is very large and we need very small part of it.