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

Add note about isTerminated #1178

Closed
wants to merge 1 commit into from
Closed

Add note about isTerminated #1178

wants to merge 1 commit into from

Conversation

mifi
Copy link
Contributor

@mifi mifi commented Dec 9, 2024

closes #1177

@ehmicky
Copy link
Collaborator

ehmicky commented Dec 9, 2024

@mifi Thanks for this PR.

However, this additional explanation might add more confusion than clarity in this specific case.

If a process handles a signal, it removes the OS's default behavior, which for most signals (like SIGTERM) is to terminate the process. Therefore, a better way to put it would be:

"When a subprocess was terminated by a signal, error.isTerminated is true. Please note that if a subprocess handles a non-forceful termination signal (like SIGTERM), it is not terminated by default anymore."

However that last sentence is rather unrelated to Execa. Execa does not know whether the process handled a termination signal or not. It just knows whether the process was terminated by a signal or not.

That sentence is also not always true. While this is how Unix behaves at the OS level, some specific runtimes or tools might behave differently. For example, a test runner could let users handle SIGTERM, but add its own event handler to still terminate the process with a signal afterwards.

In the end, the only thing that is knowable from a OS standpoint is whether the process was ultimately terminated by a signal or not, which is what error.isTerminated is representing.

@ehmicky ehmicky closed this Dec 9, 2024
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.

isTerminated false after kill()
2 participants