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
4
votes
4 answers

Java Threads and Shutdown Hook

I've just run into an interesting issue. It seems that if, in Java, a thread calls System.exit() it cannot then be joined via Thread.join(). This is causing me issues as I want to use a shutdown hook to clean up after my application, such…
greydamian
  • 153
  • 2
  • 9
4
votes
1 answer

How can I use SIGINT to break out of the wait for accept() or read()?

I'm currently trying to break out of the wait for accept() and/or write() by using signals, in this case SIGINT. My the program doesn't leave either as expected. void sigHandler(int signal ){ printf(" Exit\n"); //x is global x = 1; …
nzondlo
  • 4,166
  • 4
  • 18
  • 20
4
votes
1 answer

Stopping the inferior process in GDB WITHOUT a signal?

Is there a way to stop the inferior without using Ctrl+C (or an equivalent signal sent from another process?) I'm using a windows platform and am managing GDB from another process, so with no notion of signals, it seems that there isn't a good way…
Ryan
  • 4,179
  • 6
  • 30
  • 31
3
votes
3 answers

How can I interrupt a blocking method in python?

Usually I can interrupt stuff with Ctrl+C, but sometimes when I'm using threads it doesn't work - example below. Python 2.7.1+ (r271:86832, Apr 11 2011, 18:13:53) [GCC 4.5.2] on linux2 Type "help", "copyright", "credits" or "license" for more…
wim
  • 338,267
  • 99
  • 616
  • 750
3
votes
1 answer

KeyboardInterrupt with Python multiprocessing.Pool

I want to write a service that launches multiple workers that work infinitely and then quit when main process is Ctrl+C'd. However, I do not understand how to handle Ctrl+C correctly. I have a following testing code: import os import multiprocessing…
3
votes
1 answer

nodejs forever detect SIGKILL or SIGINT event

I launch a nodejs program on server running Ubuntu 14.04.4 LTS (GNU/Linux 3.13.0-74-generic x86_64), using forever version v0.15.2. In my program (IoT1.js), I need to detect when it is killed (for another launch) so that I can write the last states…
quanguyen
  • 1,443
  • 3
  • 17
  • 29
3
votes
1 answer

Sending SIGINT from within a MATLAB GUI

From within a MATLAB GUI application, I'm starting an external program (a console application on Windows) that takes care of reading data from a measurement system. The data is stored in several files that are processed by the MATLAB application as…
Atze Kaputtnik
  • 262
  • 3
  • 10
3
votes
0 answers

How can SIGINT can be raised by the system itself?

I know that a SIGINT signal can be raised by the user with Crtl + C or a kill command, but what needs to happen for the system to raise a SIGINT by itself? This question comes to my mind because my system just caught a SIGINT signal while using the…
3
votes
0 answers

Python thread lock never gets released if Queue.get() is interrupted

I'm working in Python3.7 with multiple threads communicating with queues. If my program is interrupted or encounters an unexpected error, I would like it to fully cleanup and gracefully exit. However, I have noticed that on certain occasions, when…
Kevin Guo
  • 31
  • 1
  • 2
3
votes
1 answer

How do I stop Ctrl-C from killing spawned processes with jruby?

I have a ruby program, spawning new processes. I want these to survive their parent even when I press Ctrl-C. To accomplish this, I try to trap INT, However, this doesn't help. The program below starts an xeyes each time you press enter, quits if…
JenEriC
  • 758
  • 7
  • 10
3
votes
1 answer

How to access local variables while handling ctrl-C event?

I wondered if it is possible to access variables local to the function running at the time ctrl-C interrupts the flow. Example, where main() is running when ctrl-C is pressed: def main(myInfo): signal.signal(signal.SIGINT, KeyboardBreak) …
m100psi
  • 43
  • 3
3
votes
1 answer

Python Send SIGINT Signal Subprocess On Windows

I have readed so many questions on stackoverflow but they are too old and not helpful for me. I have a subprocess and want to send CTRL_C_EVENT Signal to stop it. I don't want to kill it directly. Here is my code : import subprocess import…
sword1st
  • 525
  • 3
  • 7
  • 21
3
votes
1 answer

Inhibit SIGINT for the process in group

I have a bash script, which start 2 processes: openocd ...flags... 2>openocd.log & arm-none-eabi-gdb When in gdb, interrupting execution with Ctrl+C causes openocd to receive SIGINT as well and, thus it stops. I've tried to trap and reissue SIGINT…
Peter V
  • 71
  • 4
3
votes
1 answer

Temporarily ignore SIGINT in Python

I want to run a bunch of commands that take a while, but cannot be interrupted (firmware updates). I want to exit if a sigint was received earlier. I tried replacing signal.SIG_IGN with a class that counts each time a SIGINT was received, but after…
TaylorSanchez
  • 463
  • 1
  • 5
  • 8
3
votes
1 answer

How to send "CTRL+C" to child process in Node.js?

I tried to spawn child process - vvp (https://linux.die.net/man/1/vvp). At the certain time, I need to send CTRL+C to that process. I am expecting that simulation will be interrupted and I get the interactive prompt. And after that I can continue…
Alexandr
  • 134
  • 2
  • 9