What does stopping a running process do?

已回答

I'm trying to use PyCharm to work on an existing codebase that runs a server.

When I terminate the process in the "run" window of PyCharm it prints out "Process finished with exit code 143". I know it doesn't use SIGTERM or a KeyboardInterrupt to stop the process because the server code handles those (to stop the process cleanly). I can't figure out how PyCharm stops the process - I need to know so I can make it terminate the server cleanly in that situation (most notably I need to terminate the worker process pool attached to the server).

So, how does the "stop" button in the "run" display actually stop the program?

1

I would also like to know what this does... I really need to gracefully shut down my running processes, but I have not been able to do so with PyCharm.

A SIGTERM or KeyboardInterrupt or sys.exit call would have been nice.

Also I may be totally confused, but the top of this post says "Possibly answered", but I cant see the answers... huh?

0

I'm trying to do something similar. Im running a cherrypy server from idea ide. When I run the server from terminal I can ctrl+c to do a clean exit. How can I do the same thing from the idea console?

0

I would very much like to know the answer to this also.

I am running a homegrown multiprocess python application.

When the stop button is clicked the parent process is killed but it never receives any of the standard signals

so it is unable to shutdown its child processes cleanly

Knowing how to properly handle this would be a huge benefit.

0

Hi, sorry for late answer.

Under Unix process receives SIGINT first, then SIGKILL if it wasn't killed.

Under Win normal process is just terminated, while Django server is closed by Ctrl+Break (to destroy both processes correctly).

0

Thanks, but my process never receives SIGINT

0

Same here, my process just... dies, no signal, no nothing.

0

I agree, none of these signals arrive:

$SIG{'HUP'} = \&sigIntHandler;
$SIG{'INT'} = \&sigIntHandler;
$SIG{'KILL'} = \&sigIntHandler;
$SIG{'TERM'} = \&sigIntHandler;

when run from comand line the program receives the correct signal

The previous post is FIVE AND A HALF YEARS OLD. No fix? What is up with that?
1

Yeah, I would think this comes up a lot. What workaround does jetbrains suggest?

0

请先登录再写评论。