Questions tagged [sigint]

On POSIX-compliant platforms, SIGINT is the signal sent to a process by its controlling terminal when a user wishes to interrupt the process.

On POSIX-compliant platforms, SIGINT is the signal sent to a process by its controlling terminal when a user wishes to interrupt the process.

Wikipedia: https://en.wikipedia.org/wiki/SIGINT_%28POSIX%29#SIGINT

369 questions
6
votes
2 answers

Send Ctrl-C to app in LLDB

I have an CLI app that is seg faulting during termination (After sending a Ctrl-C) Pressing Ctrl-C in lldb naturally pauses execution. Then I try: (lldb)process signal SIGINT (lldb)process continue But that doesn't actually seem to do anything to…
orb360
  • 135
  • 1
  • 3
6
votes
2 answers

SIGINT to cancel read in bash script?

I'm writting a bash wrapper to learn some scripting concepts. The idea is to write a script in bash and set it as a user's shell at login. I made a while loop that reads and evals user's input, and then noticed that, whenever user typed CTRL + C,…
mgarciaisaia
  • 14,521
  • 8
  • 57
  • 81
6
votes
2 answers

Ctrl-c stopped working in cygwin

Ctrl-c (SIGINT/SIGTERM) stopped working in cygwin. If I recall, this might have something to do with TTY settings. Please advise on how to get it working again. I did not change anything intentionally Output from stty -a: $ stty -a speed 38400 baud;…
MetaChrome
  • 3,210
  • 6
  • 31
  • 48
5
votes
1 answer

Thin doesn't respond to SIGINT or SIGTERM

bundle exec thin start -p 3111 gives the following output: Using rack adapter Thin web server (v1.2.11 codename Bat-Shit Crazy) Maximum connections set to 1024 Listening on 0.0.0.0:3111, CTRL+C to stop ^C Ctrl-C doesn't do…
Michiel de Mare
  • 41,982
  • 29
  • 103
  • 134
5
votes
0 answers

Is SIGINT intrinsically unreliable in python?

I have an application that relies on SIGINT for a graceful shutdown. I noticed that every once in awhile it just keeps running. The cause turned out to be a generator in xml/etree/ElementTree.py. If SIGINT arrives while that generator is being…
5
votes
1 answer

How to handle ctrl+c in a shell script?

I am trying to handle ctrl+c in a shell script. I have code running in a while loop but I am calling the binary from a shell script and running it in the background so when I want to stop the binary it should stop. Code is below of hello.c #include…
Sagar Talole
  • 51
  • 1
  • 3
5
votes
1 answer

end child gracefully when doing Ctrl-C in NodeJS

I have a architecture with one parent that spawns a child as follow : this.process = child.spawn(this.cmd, this.args); this.process.on('exit', (code: number, signal: string) => { this.exitCode = code; console.log(`exit code:…
Hattori
  • 351
  • 4
  • 15
5
votes
1 answer

who send SIGINT to foreground process when press ctrl+c, tty driver or shell

When I press ctrl+c while a login shell is executing commands, the foreground process gets killed. Who sends the signal? Does TTY-driver send SIGINT to foreground process group directly? Or does the TTY-driver send SIGINT to shell and shell…
yuanjianpeng
  • 335
  • 1
  • 9
5
votes
1 answer

Listen for terminal session "close" event

In a terminal I start a background process A, which in turn starts a process B. Process B writes to the terminal (process A has passed B the correct TTY file descriptor). What I am afraid of, is if the user (in some cases, me) closes the terminal…
Alexander Mills
  • 90,741
  • 139
  • 482
  • 817
5
votes
3 answers

Signal passing to managed processes using supervisord

I am using supervisord to spawn and manage a FastCGI application that I am writing in C for a linux target. I have a signal handler that gracefully exits my application when SIGINT is received. I have verified that the signal handler works as…
HikeOnPast
  • 456
  • 4
  • 13
5
votes
1 answer

Can I trap signals in R?

In bash I can trap SIGINT, SIGKILL, SIGTERM, and so on. That allows me to do different things depending how the program was unexpectedly stopped. Is there a way to do this in R?
isomorphismes
  • 8,233
  • 9
  • 59
  • 70
5
votes
1 answer

How does catching Ctrl-C works in Node?

I have the following program in Node.js on Ubuntu: process.on ("SIGINT", function(){ console.log("You clicked Ctrl+C!"); process.exit(1); }); while(1) { } When I click Ctrl+C, I see "^C" on the screen, but nothing else is printed the…
Erel Segal-Halevi
  • 33,955
  • 36
  • 114
  • 183
5
votes
1 answer

Capture keyboard interrupt in bash

I have a function in bash which captures the keyboard interrupt. The function looks like this: user_interrupt(){ echo -e "\n\nKeyboard Interrupt detected." sleep 2 echo -e "\n Cleaning up..." rm -rf…
rahuL
  • 3,330
  • 11
  • 54
  • 79
5
votes
3 answers

Saving work after a SIGINT

I have a program which takes a long time to complete. I would like it to be able to catch SIGINT (ctrl-c) and call the self.save_work() method. As it stands, my signal_hander() does not work since self is not defined by the time the program…
unutbu
  • 842,883
  • 184
  • 1,785
  • 1,677
5
votes
1 answer

Can I send SIGINT to a Python subprocess on Windows?

I've got a Python script managing a gdb process on Windows, and I need to be able to send a SIGINT to the spawned process in order to halt the target process (managed by gdb) It appears that there is only SIGTERM available in Win32, but clearly if…
Ryan
  • 4,179
  • 6
  • 30
  • 31