Skip to main content

Questions tagged [sigint]

The tag has no summary, but it has a tag wiki.

4 votes
0 answers
225 views

Confused about SIGINT trap

I am confused about the processing of SIGINT and EXIT traps in Bash scripts. I wrote this script to test: #!/usr/bin/env bash set -e exit_trap() { printf "In exit_trap \$?=$?\n" exit 0 ...
Alexey's user avatar
  • 2,380
-1 votes
1 answer
2k views

What does "trap: SIGINT: bad trap" mean and how do I fix it?

I moved code to a new virtual server running Ubuntu 22. I have the following (edited to make names shorter) in my crontab so that it runs myCommand only if it is not already running: */1 * * * * ...
ferzle's user avatar
  • 3
0 votes
1 answer
437 views

Run a command after interrupting while loop with Ctrl-C in bash one-liner?

In the below one-liner, I run an "infinite" while loop which prints some numbers: $ bash -c 'trap stopit SIGINT; run=1; stopit() { run=0; }; while [ $run ]; do for i in {0..4}; do v=$(($i*50)...
sdbbs's user avatar
  • 590
0 votes
1 answer
360 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 &...
Chap's user avatar
  • 389
0 votes
2 answers
1k 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 ...
Manuel Jordan's user avatar
11 votes
1 answer
3k 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 ...
mpb's user avatar
  • 1,861
0 votes
1 answer
2k 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....
ddulaney's user avatar
  • 165
0 votes
0 answers
2k 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 = $!...
juvor's user avatar
  • 149
4 votes
2 answers
11k views

How to 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 ...
Kirby's user avatar
  • 201
1 vote
0 answers
49 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 ...
cdgraham's user avatar
  • 111
1 vote
1 answer
430 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 ...
Johannes Ernst's user avatar
5 votes
1 answer
3k 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 ...
Roflo's user avatar
  • 379
0 votes
1 answer
2k 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 ...
starbeamrainbowlabs's user avatar
4 votes
2 answers
4k 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 ...
Albion Shala's user avatar
2 votes
2 answers
336 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. ...
glarry's user avatar
  • 974

15 30 50 per page