Questions tagged [sigint]

The tag has no usage guidance, but it has a tag wiki.

Filter by
Sorted by
Tagged with
0 votes
1 answer
21 views

Does a handled SIGINT affect pipe communication with a child process?

I have an interactive C program that reads a phrase from the terminal, and computes a series of anagrams. I also have a Perl program that reads and buffers lines from STDIN until receiving a reserved &...
  • 349
0 votes
2 answers
272 views

When is mandatory send SIGINT programmatically?

I know the recommendable way to terminate a foreground process is through the SIGTERM signal, it because it gives the opportunity to the process itself to clean/release resources. This signal only can ...
8 votes
1 answer
1k views

Why does sleep, when run in a shell script, ignore SIGINT?

When I run sleep manually, and then kill -INT it, sleep exits immediately. For example: $ /bin/sleep 60 & [1] 4002356 $ kill -INT 4002356 [1]+ Interrupt /bin/sleep 60 $ ps -C ...
  • 1,306
0 votes
1 answer
507 views

Is it possible to force a program that ignores signals to quit on ctrl-C?

I have a program that ignores SIGINT but that I want to run in the foreground. I would like to find a way to force it to close on Ctrl-C. Is there any way to write a wrapper (that you'd call ./wrapper....
  • 165
1 vote
0 answers
916 views

Send SIGINT to a command launched inside bash script

I am executing a bash script and I want to correctly terminate a command (by pressing CTRL+C) that I am launching inside the script. This is the script: trap ctrl_c SIGINT function ctrl_c() { PID = $!...
  • 41
3 votes
2 answers
3k views

How make CTRL-C work in command line when it does not?

I'm struggling with not working CTRL+C in a certain environment shell command line (CentOS 7 / Vagrant guest of Windows host). I use bash there. The OS, seem, does not matter. Example run sleep 1000 ...
  • 163
2 votes
0 answers
44 views

Why does dmenu block SIGINT propagation?

When running Jetbrains IDEs (such as PyCharm and Android Studio) through dmenu, I get the following warning: The IDE ignores SIGINT: the "Stop" button in run configurations may not work. It then ...
  • 121
1 vote
1 answer
174 views

Prevent SIGINT from reaching mysql subprocess

I have a perl script, which indirectly invokes mysql (to execute a long SQL script). I would like to disable Ctrl+C while that script is running, but somehow the signal still reaches mysql, which then ...
4 votes
1 answer
1k views

Just how dangerous is sending SIGINT to resize2fs tasked with shrinking?

I inherited an old PC-server (quad Pentium 4) that only had partitions for /, /boot and swap (RAID1 with 2 1T SATA disks), but needed to update the distro (from CentOS 6.9). I decided to create a new ...
  • 369
0 votes
1 answer
1k views

Why doesn't CTRL + C exit vim? [duplicate]

I'm aware that if I press esc followed by typing :q!, I can exit the vim editor, due to this question. However, the standard convention is for programs to exit when ctrl + c is pressed, which sends a ...
3 votes
2 answers
3k views

C SIGINT signal in Linux

I want to make a specific combination of keyboard keys in order to terminate a process e.x I want to terminate the process by pressin CTRL + C ^ 3 (pressing three times C: CTRL +CCC). So basically I ...
3 votes
2 answers
224 views

Regain ability to use ^C to close backgrounded then (effectively) foregrounded processes

In the interactive console, pressing ^C on zenity --info & fg closes the Zenity window. One can only use zenity --info & wait in a script. But ^C doesn't close the Zenity window in this case. ...
  • 884
2 votes
1 answer
509 views

Legitimate reasons for a program to intercept, internally handle and ignore SIGINT signal

We know that - aside from SIGKILL and SIGSTOP - a program can intercept IPC signals, and run its internal handler circumventing the operation of the default handler. I can think of at least one very ...
  • 1,998
2 votes
1 answer
2k views

Stop CTRL+C Exiting Local Script Which is Running tcpdump in Remote Machine

I have setup a simple script like the below: sshpass -p $password ssh -T $username@$ip_address -p 30007 <<- EOF > $save_file.pcap sh tcpdump -i eth5.1 -s 0 -n -v -U -w - EOF sed -i '...
  • 23
3 votes
1 answer
2k views

Process started by script does not receive SIGINT

I am on Ubuntu 16.04.5 LTS (AWS) I am creating a python process via this command: nohup python -u main.py > nohup.out 2>&1 & I would like to send a ctrl-c/SIGINT to the process, so I ...
  • 131
2 votes
2 answers
411 views

Why does this script keep running after receiving SIGINT?

I learned from https://unix.stackexchange.com/a/230568/674 thatping will exit with 0 after receiving SIGINT, which allows a bash script containing a ping command to continue running instead of exiting....
  • 92.7k
3 votes
1 answer
792 views

How to create a bunch of background processes in terminator terminals later kill them in bash

I'm trying to write a batch script that creates new terminator terminals and then runs a process in each one. I want them to keep running in the background until I decide to kill them. I want the ...
1 vote
3 answers
8k views

How to send SIGINT to multiple processes

I am trying to send the SIGINT signal to multiple processes, I think this is right: kill -2 <pid1> <pid2> ... <pid3> but I cannot confirm that...
1 vote
0 answers
1k views

How to properly handle SIGINT for both the interactive and non-interactive Bash scripts?

Backgound I have read a post about handling of SIGINT signal, but I still don't understand how to properly handle it in code which will be sourced and used by both the interactive and non-interactive ...
  • 927
1 vote
1 answer
270 views

Does Ctrl-C (SIGINT) prevent output to be shown even if there were processes trying to output it

I had a bash script which did the wrong thing. So I pressed Ctrl-C to stop it. Is now the output I currently see on my terminal all the output produced by the processes that have run. Are does Ctrl-...
1 vote
1 answer
289 views

When receiving SIGINT, does bash also quit other commands, besides loops (for or while)?

From bash manual When Bash receives a SIGINT, it breaks out of any executing loops. When receiving SIGINT, does bash also quit other commands, besides loops (for or while)? Thanks.
  • 92.7k
2 votes
1 answer
758 views

Trap "break" not working while read command is being called

I have this bash-written hangman game for a school project, and currently I am trying to replace the ctrl-c exit command for a while loop break, so the user goes back from the actual game to the ...
3 votes
1 answer
897 views

docker-compose, less and SIGINT

I have a script that boots up a test environment using docker-compose. This script pipes the mixed stdout of many docker containers on stdout through less: # This is part of a larger script with some ...
  • 131
5 votes
0 answers
278 views

Interrupt a slow gdb command?

I unwisely asked gdb to list all defined functions. (gdb) info function Now it is excitedly slurping up CPU and memory. If I'm really quick about it, GDB will stop with Ctrl-C and give me a prompt ...
1 vote
1 answer
1k views

Trap handler not working?

Is sth wrong with the following trap? trap cleanup SIGINT cleanup() { echo "Exiting script ..." } I never see the echo command when hitting Ctrl+c The snippet is at the bottom ...
  • 2,305
1 vote
0 answers
191 views

Multiple ctrl + c freezes program

I have a "main" bash script that runs another bash script (23.sh). In the main script, I have a function that catches Ctrl+C operations and prompts for a password. If password is entered correctly, ...
  • 131
-1 votes
1 answer
2k views

ctrl+c closes terminal window completely - why / how?

I have a process, and when I issue ctrl+c in the terminal, it closes the terminal window completely, anybody know why that might be happening? This is how the process is now started: exec "$(dirname ...