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

Handling of ProcessTimedOutException is unreliable #3782

Open
jimwins opened this issue Feb 23, 2024 · 0 comments
Open

Handling of ProcessTimedOutException is unreliable #3782

jimwins opened this issue Feb 23, 2024 · 0 comments

Comments

@jimwins
Copy link

jimwins commented Feb 23, 2024

The output of the ps x | ... command is not checked to see if a PID was actually retrieved. This can happen with a command that is long enough that the $shellId doesn't appear because it's only using ps x instead of ps wwx.

You could also eliminate the use of grep by making it: ps wwx | awk '/$shellId/ && !/awk/ {print \$1; exit}'

// Let's try to kill all processes started by this command.
$pid = $this->run($host, "ps x | grep $shellId | grep -v grep | awk '{print \$1}'");
// Minus before pid means all processes in this group.
$this->run($host, "kill -9 -$pid");

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

No branches or pull requests

2 participants