Skip to content

Conversation

@pakrym-oai
Copy link
Collaborator

The repo we were depending on is very large and we need very small part of it.

Comment on lines +66 to +75
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(())
}
}
Copy link
Contributor

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

msft docs: https://learn.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-terminateprocess#return-value

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good, catch! I'll keep the code as is for now to minimize changes but will keep this in mind.

Comment on lines +96 to +104
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(())
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar here

@pakrym-oai pakrym-oai enabled auto-merge (squash) December 9, 2025 17:16
@pakrym-oai pakrym-oai merged commit 164265b into main Dec 9, 2025
26 checks passed
@pakrym-oai pakrym-oai deleted the pakrym/vendor-conptysystem branch December 9, 2025 17:23
@github-actions github-actions bot locked and limited conversation to collaborators Dec 9, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants