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

[unix] Output::Killed in results may be inaccurate #2

Open
Silic0nS0ldier opened this issue Jun 27, 2024 · 0 comments
Open

[unix] Output::Killed in results may be inaccurate #2

Silic0nS0ldier opened this issue Jun 27, 2024 · 0 comments

Comments

@Silic0nS0ldier
Copy link

libc's rather poorly named kill(...) function returns when the specific signal is delivered. This means;

  • For SIGTERM, kill(...) may return before the target process has terminated. It may even ignore the signal.
  • For SIGKILL, the operation is handled by the kernel so generally by the time kill(...) returns the target will be terminated. However that isn't certain.

Both cases also may be rejected with EPERM (permission error).

Unfortunately checking process liveliness (e.g. with getpid on macOS or /proc/ on Linux) can't provide clarity here either, since process IDs are reused (not an issue on Windows from memory). Not to mention liveliness checks would need to contend with SIGTERM potentially doing nothing and both taking an undefined length of time to take effect.

The end result is Output::Killed is more of a Output::MaybeKilled.

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

No branches or pull requests

1 participant