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
0
votes
2 answers

Exiting program after catching SIGINT signal

I have a client app implemented with OpenMP. This program terminate when it receives a SIGINT signal, but in that case it should first send a message to the server indicating that the user logged out. I have implemented the messaging successfully,…
krakra
  • 35
  • 8
0
votes
1 answer

SIGINT SIGQUIT Bash script

I need to write a script that has the following behaviour: If the script receives the signal SIGINT, then the script increments the value of the counter by one and prints its value to the standard output. If it receives the signal SIGQUIT, then it…
JohnSnow
  • 17
  • 4
0
votes
1 answer

How to send interrupt/ ctrl C during execution of expect script

I am trying to execute some commands and one of which will not come back to console and need to explicitly bring it using ctrl+ c. After that I need to execute some more commands in that script. expect "$ " send "sh…
Karthik
  • 3
  • 3
0
votes
2 answers

Ruby: monkey patch module for signal handling

I'm using a library that doesn't exit gracefully when receiving signals like INT or TERM. I would like to trap them and exit gracefully. Is is possible to monkey patch signal trapping into an external module? Signal trapping for my code works fine,…
Reuben
  • 53
  • 5
0
votes
1 answer

Inconsistency when trying to ignore SIGINT

I am of the understanding that when you set a signal handler, all child processes inherit said handler by default. Thus, the following code runs as expected: import subprocess, signal signal.signal( signal.SIGINT, signal.SIG_IGN ) # use the ignore…
maambmb
  • 881
  • 1
  • 8
  • 18
0
votes
0 answers

Python-2.7: No SIGINT possible in while loop with locks

I implemented a while loop with locks in python-2.7 (see example) to handle two lists which are loaded with values by an other thread each. The code works, but it will not handle SIGINT (Ctrl-C) anymore. Example: while True: with lock1: if 0…
0
votes
1 answer

handle SIGINT with scanf in loop

I have to take input from user in a while loop and then take some action. And I also want to exit my code on ctrl+c input. void my_signal_handler(int sig) { running = false; signal(sig, SIG_IGN); } int main(void) { struct sigaction sa =…
Patrick
  • 2,464
  • 3
  • 30
  • 47
0
votes
0 answers

Exiting node.js command line app with SIGINT

Is this at all correct? var sigintCount = 0; process.on('SIGINT', () => { console.log('Got your SIGINT => Press Control-C *twice* to exit.'); sigintCount++; if(sigintCount > 1){ process.exit(); //what is an appropriate exit…
Alexander Mills
  • 90,741
  • 139
  • 482
  • 817
0
votes
1 answer

Ended program (Flask) keeps sending output to STDOUT?

I'm going totally crazy here. I'm developing a website using the Python Flask framework and since this afternoon my Linux box is behaving like a mad man. Let me explain. I've got my Flask website on an Ubuntu 14.04 server. I normally run it using…
kramer65
  • 50,427
  • 120
  • 308
  • 488
0
votes
1 answer

BASH script exiting out before completion

I have a long bash script doing a number of things that reaches this point... (at the end of a case statement)... { /usr/bin/expect << EOF set timeout 120 spawn ssh -o StrictHostKeyChecking=no root@$AMHOST1$DOMAIN…
0
votes
1 answer

waitpid(pid,status,0) status not reading correctly

everyone. I've got a problem that is making me very confused. I'm just trying to print out the status received from a terminated process but it isn't working the way I thought it would. Here is the code. int main(int argc, char *argv[]) { …
Paul Myers
  • 41
  • 1
  • 1
  • 6
0
votes
0 answers

C - Stop running a function if I receive SIGINT

I am trying to implement my own shell, and I don't figure out how to stop a function that it is running in foreground, if I get a SIGINT signal. When this function is in background, it's easy, I only have to create a son, and he will run the…
Homer
  • 85
  • 7
0
votes
0 answers

how to get CTRL-C to send SIGINT to a NON-CONSOLE windows application

* This is not a duplicate question. The other question title does not match its body! The other question title should be: "how do you send a SIGINT from one Windows process to another". It has nothing to do with Ctrl-C and he IS using Console…
0
votes
2 answers

What's a good manner to use SIGINT for killing app in C++?

I'm developing a server application and want to use SIGINT for killing application. Although I know 2 ways, I'm not sure which are good way to kill this application. Are there any better ways to handle SIGING? int main() { startServer(); 1.…
jef
  • 3,890
  • 10
  • 42
  • 76
0
votes
1 answer

How to silently termintate a Java program with threads and locks

In C programs using system threads for example, I can pass a SIGINT with Ctrl+C and the process will be killed silently. But when I do the same thing to a Java program with threads, locks, semaphores et cetera, the JVM just stops there and I have to…
user3810155