Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sending SIGINT (Ctrl-C) to program running in Eclipse Console

I have setup a run configuration in Eclipse and need to send SIGINT (Ctrl+C) to the program. There is cleanup code in the program that runs after SIGINT, so pressing Eclipse's "Terminate" buttons won't work (they send SIGKILL I think). Typing CTRL+C into the Console also doesn't work.

How do I send SIGINT to a process running inside an Eclipse Console?

(FWIW I am running a Twisted daemon and need Twisted to shutdown correctly, which only occurs on SIGINT)

like image 564
vsekhar Avatar asked Jan 11 '12 05:01

vsekhar


2 Answers

If you can determine the process with a utility such as ps, you can use kill to send it a SIGINT. The program will likely be a child process of eclipse.

kill -s INT <pid>
like image 94
jordanm Avatar answered Nov 20 '22 12:11

jordanm


You can send the command via one line:

 kill -SIGINT $(ps aux | grep ProgrammName | grep -v grep | awk '{print $2}') 

Get the process id and than send the sigint signal

like image 27
John Smithv1 Avatar answered Nov 20 '22 12:11

John Smithv1