Skip to content

libpsl-native: add KillProcess and WaitPid functions #63

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

Merged
merged 1 commit into from
May 17, 2021

Conversation

dinhngtu
Copy link
Contributor

These functions are used by powershell-unix to clean up SSH processes
after they exit.

First part of fixes for PowerShell/PowerShell#13356.

These functions are used by powershell-unix to clean up SSH processes
after they exit.
@ghost
Copy link

ghost commented Jan 19, 2021

CLA assistant check
All CLA requirements met.

@adityapatwardhan
Copy link
Member

@andschwa Can you help review this?

//!
bool KillProcess(pid_t pid)
{
return kill(pid, SIGKILL) == 0;
Copy link
Member

Choose a reason for hiding this comment

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

Seems reasonable:

Upon successful completion, a value of 0 is returned. Otherwise, a value of -1 is returned and errno is set to indicate the error.

//!
pid_t WaitPid(pid_t pid, bool nohang)
{
return waitpid(pid, NULL, nohang ? WNOHANG : 0);
Copy link
Member

Choose a reason for hiding this comment

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

This seems fine to me, checked against the man pages on BSD and Linux.

@adityapatwardhan adityapatwardhan merged commit deb01d6 into PowerShell:master May 17, 2021
@dinhngtu dinhngtu deleted the waitfix branch June 3, 2021 20:22
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

Successfully merging this pull request may close these issues.

3 participants