Questions tagged [control-c]
30 questions
102
votes
3 answers
Catching Ctrl+C in Java
Is it possible to catch the Ctrl+C signal in a java command-line application? I'd like to clean up some resources before terminating the program.

Pierre
- 34,472
- 31
- 113
- 192
8
votes
2 answers
Interrupting Python raw_input() in a child thread with ^C/KeyboardInterrupt
In a multithreaded Python program, one thread sometimes asks for console input using the built-in raw_input(). I'd like to be able to be able to close the program while at a raw_input prompt by typing ^C at the shell (i.e., with a SIGINT signal).…

adrian
- 1,447
- 15
- 24
8
votes
1 answer
How to kill a scan operation in hbase shell without Ctrl-C
Sometimes when I run a scan '. I see a continuous flood of data being printed because the table is big. I want to kill the process that print the data. Is there a way to do it other than Ctrl-C? because Ctrl-C kills the shell process and…

ssgao
- 5,151
- 6
- 36
- 52
6
votes
1 answer
Delegate signal handling to a child process in python
How can I run a command from a python script and delegate to it signals like Ctrl+C?
I mean when I run e.g:
from subprocess import call
call(["child_proc"])
I want child_proc to handle Ctrl+C

remdezx
- 2,939
- 28
- 49
5
votes
1 answer
DTrace END probe never fires
I have a mid-2009 MacBook Pro and a new 2012 MacBook Pro and I am in the process of learning DTrace ( a pretty amazing tool). When I calculate aggregates on the new 2012 MBP, the aggregates don't print out.
sudo dtrace -n 'syscall:::entry {…

SargeATM
- 2,483
- 14
- 24
4
votes
1 answer
Using CTRL-C to discard current line and start the next line in a REPL
I'm writing a REPL in Haskell. The basic idea looks like this:
repl :: IO ()
repl = do putStr ">> "
hFlush stdout
input <- getLine
...
repl
I'd like to mimic some GHCi behaviour that when CTRL-C is pressed,…

Futarimiti
- 551
- 2
- 18
4
votes
1 answer
Java Swing: Why drag and drop in JFrame will trigger the "Ctrl+C" accelerator?
I create a JFrame and place a JMenuBar into it, a "Copy" menu item with "Ctrl+C" accelerator is added. The complete source code are pasted below. When I do drag and drop within the JFrame, I can see the "Ctrl+C" accelerator is triggered (since…

Xavier Young
- 368
- 3
- 8
4
votes
0 answers
ctrl-c killing my background processes in my shell
I'm trying to write a basic a shell in C. One of things I need to do, is be able to have both background and foreground processes. Control-C must kill the foreground process (if there is one), and must not kill any background processes.
I wrote a…

Yep_It's_Me
- 4,494
- 4
- 43
- 66
3
votes
1 answer
Why does Teamcity send a keyboard interrupt to kill my build?
I have a build running in TeamCity, with only one build step: launching a BAT file. TeamCity sometimes kills my build with a (double) keyboard interrupt, and I have no idea why. The output at the end of the build is like this:
Running build…

Keith Pinson
- 7,835
- 7
- 61
- 104
3
votes
3 answers
Send Control-C to a process running trough Runtime.getRuntime().exec("su");
I'm developping an app which needs to run a command as root user so I use:
process = Runtime.getRuntime().exec("su");
Then I launch te process with:
os = new DataOutputStream(process.getOutputStream());
os.writeBytes("tcpdump\n");
When I need the…

Jimix
- 1,539
- 3
- 15
- 20
3
votes
1 answer
Sending control+c (SIGINT) to NSPIPE in objective-C
I am trying to terminate an openvpn task, spawned via NSTask.
My question:
Should I send ctrl+c (SIGINT) to the input NSPipe for my NSTask?
inputPipe = [NSPipe pipe];
taskInput = [inputPipe fileHandleForWriting];
NSString dataString =…

Ron
- 1,610
- 15
- 23
3
votes
1 answer
In Windows 7, how to send a Ctrl-C or Ctrl-Break to a separate process
Our group has long running processes which run daily. The processes are typically started at 9pm on any given day and run until 7pm the next day. Thus they typically run 22hrs/day. They are started by scheduled tasks on servers under a particular…

David I. McIntosh
- 2,038
- 4
- 23
- 45
2
votes
1 answer
Linux Bash Script: Command Executed After Control-C
My goal is to open a new terminal window, SSH into a remote machine in that window, prompt the user to continue, and then execute a command. I currently have:
gnome-terminal -t "MyWin" -x bash -c "ssh -X $USER@$REMOTE_IP 'echo \"Press ENTER to…

Vincent
- 33
- 5
2
votes
2 answers
Powershell AcceptTcpClient() cannot be interrupted by Ctrl-C
I am writing a simple TCP/IP server using Powershell. I notice that Ctrl-C cannot interrupt the AcceptTcpClient() call. Ctrl-C works fine after the call though. I have searched around, nobody reported similar problem so far.
The problem can be…

oldpride
- 761
- 7
- 15
2
votes
1 answer
Stopping a python program
I have a python program that displays battery voltages and temperatures in an electric car. I typically run it from a command line on a Mac by simply using the up arrow to find the command to change directory, and then up arrow to find the command…

user1330678
- 21
- 1
- 2