-
Notifications
You must be signed in to change notification settings - Fork 492
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
NAS-133058 / 25.04 / simplify service.terminate_process #15194
Conversation
7171d96
to
2f7cea2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you
Returns: | ||
boolean: True if process was terminated with SIGTERM, false if SIGKILL was used | ||
""" | ||
if pid == 0 or pid == os.getpid(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking at kill(2)
man page I wonder whether we should also eliminate all negative values of pid
.
This PR has been merged and conversations have been locked. |
psutil is expensive in about every way imaginable. This method doesn't require using it so I've simplified the method to use built-in modules provided by python.
terminate_process
since it allowed terminating pid 0 or middlewared (itself)