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
1 answer

Why is this Python code not catching KeyboardInterrupts?

To start with, I've looked at all other solutions. I've made sure that my IDE/Editor (Atom) is not catching inputs. I've looked to see if any of my code is awkwardly blocking Ctrl-C's. I've use time.sleep, signal, threads, you name it. I cannot…
0
votes
0 answers

Python: terminate nested loops via Ctrl+c

I have a python program with nested for and while loops. I already read here about using KeyboardInterrupt and here about using SIGINT. I implemented a try-catch block inside each loop with a message and an action into the except. Indeed, I tried…
erotavlas
  • 512
  • 6
  • 18
0
votes
2 answers

How to send a keystroke to a script at a particular point while its running in bash?

I'm trying to write a script to automate installation of a program in Linux. It requires some user input during installation. Most are straight forward like simple y or n. I add these responses to a file responses.txt and just pipe it to the…
wiseindy
  • 19,434
  • 5
  • 27
  • 38
0
votes
0 answers

When Cancelling application using Ctrl+c, cpprestSDK giving exception and core Dump

the REST server is up and running but no request from any client Now the user press Ctrl+c, then i get this exception. terminate called after throwing an instance of 'pplx::invalid_operation' what(): then() cannot be called on a default…
sabby
  • 21
  • 5
0
votes
1 answer

Re-registering signal handler causes infinite loop

With the following signal handler, pressing Ctrl-C causes the handler to be called repetitively, and I don't know why: (Warning: if you type Ctrl-C, you'll have to use kill to exit the program) static void handler(int sig) { // do…
Greg Schmit
  • 4,275
  • 2
  • 21
  • 36
0
votes
2 answers

How to deal with SIGINT?

When I catch SIGINT signal in my program, how can I safely clean up resources? In signal handler function it is impossible to call delete operator, because I don't know how to release resource created with new operator. Any ideas?
PDF1001
  • 173
  • 3
  • 13
0
votes
0 answers

Spawn child process with other process group

I am catching SIGINT signal to gracefully shutdown app. I am use child process which I would like to keep till I complete shutdown (by default child process have same process group and it recievs signal same time). I use spawn to start child…
Anton Putau
  • 632
  • 1
  • 7
  • 31
0
votes
1 answer

How to request confirmation on program exit?

I want to request a plaintext password when the user tries to close the script. This is my code so far, the unrelated parts are hidden. import signal from time import sleep _password = "iAmAdmin" def _close(args): """Close the…
Jacob Birkett
  • 1,927
  • 3
  • 24
  • 49
0
votes
2 answers

send Ctrl+C in bash script if you see repeated pattern in the output

I am trying to call a script within my bash script which needs Ctrl+c Signal to stop. I need to stop that using Ctrl+c only when I see repeated output behavior from the called Script and then continue with the rest of the script. FLOW of Script…
Ataul Haque
  • 93
  • 2
  • 9
0
votes
0 answers

How to handle Ctrl-C in Java with child process?

I'm facing an annoying issue with Java and I couldn't find a solution. In my code, I create a subprocess to validate a git commit like this: void processCommit(String commitId) throws InterruptedException, IOException { int result = new…
0
votes
1 answer

signal handler does not work after threads are launched

I think similar questions were already asked in SOF. However, I could not really find a proper solution for my particular case. I am trying to make a daemon that will open up few worker threads on launch and keep on running till SIGTERM is received.…
Kamrul Khan
  • 3,260
  • 4
  • 32
  • 59
0
votes
1 answer

python: catch SIGINT in process reading data from a socket

I have a python script which I'd like to stop by sending a "SIGINT" signal using the command line: kill -2 The script spawns a child process and then enters an infinite loop where it tries to receive data from a socket. I have installed the…
toti08
  • 2,448
  • 5
  • 24
  • 36
0
votes
1 answer

SIGINT singal is being catched only once

Here's a simple recreation of this issue: void handler(int sig){ if(sig == SIGINT){ printf("Signal caught\n"); execl("./recreate","./recreate",NULL); } } int main(){ printf("Main start\n"); …
EdgarC
  • 23
  • 4
0
votes
2 answers

Handle signals in ncurses

I am writing a program in C using ncurses.I am trying to handle the CRTL C signal. In my code, this signal is being caught and dealt with but the program is not termination correctly. Could it be the way I am exiting from ncurses? //handle SIGINT…
CXB
  • 241
  • 5
  • 14
0
votes
1 answer

How to propagate signal in C from parent to child which are in own process group?

Suppose I have 10 child processes which are moved to their own process group by setpgid(0,0) just before the exec. (Each child also has children which are also in their own process group.) My foreground process gets ctrl-c SIGINT signal and I want…
pZCZ
  • 183
  • 2
  • 11