sigint Questions

6

I have the following two files in a directory: Dockerfile FROM debian WORKDIR /app COPY start.sh /app/ CMD ["/app/start.sh"] start.sh (with permissions 755 using chmod +x start.sh) #!/...
Pyridoxine asked 25/7, 2021 at 23:5

18

Solved

I have (in the past) written cross-platform (Windows/Unix) applications which, when started from the command line, handled a user-typed Ctrl-C combination in the same way (i.e. to terminate the app...
Silicate asked 1/5, 2009 at 20:18

2

Solved

Case: we have a docker container that runs a bash script that needs to "block" forever (because it exposes a volume for another container, but there are other reasons why we sometimes want this). ...
Alviani asked 17/7, 2017 at 15:42

3

Solved

I'm writting a bash wrapper to learn some scripting concepts. The idea is to write a script in bash and set it as a user's shell at login. I made a while loop that reads and evals user's input, an...
Free asked 24/10, 2012 at 21:8

4

I have a program that may have a lengthy execution. In the main module I have the following: import signal def run_program() ...time consuming execution... def Exit_gracefully(signal, frame): ...
Myrlmyrle asked 7/8, 2013 at 22:1

4

I am currently trying to write (Python 2.7.3) kind of a wrapper for GDB, which will allow me to dynamically switch from scripted input to interactive communication with GDB. So far I use self.pr...
Restricted asked 18/6, 2015 at 20:26

6

Solved

My console app traps SIGINT so it can exit gracefully. Pressing CTRL+C inside XCode while the program is being debugged, though, has no effect. I can find the process and use a terminal window to...
Edgeways asked 8/7, 2011 at 17:18

1

Solved

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 foll...

3

Solved

Title says it all. How can I handle or catch a SIGINT in julia? From the docs I assumed I just wanted to catch InterruptException using a try/catch block like the following try while true printl...
Mcdevitt asked 29/12, 2013 at 23:32

5

Solved

I've done a bit of research on this subject and am turning up blanks. There seem to be implementation-dependent ways of doing Unix signal handling in Common Lisp, but is there a package that gives ...
Desexualize asked 30/3, 2012 at 21:33

2

Solved

I am writing a Rust program that does an action every 2 seconds. The program also uses the ctrlc crate to handle interrupts. However, in some cases, I have to wait up to 2 secs when killing the pro...
Schramm asked 25/11, 2021 at 17:24

2

Solved

Here's a simple program that registers two trap handlers and then displays them with trap -p. Then it does the same thing, but in a child background process. Why does the background process ignore...
Shiprigged asked 5/9, 2017 at 19:1

1

I've found a different post on a related topic (How to perform an async operation on exit), but perhaps it doesn't apply to macOS, or just isn't true anymore when running Node.js v14. My original q...
Smolder asked 14/8, 2021 at 23:11

3

For example, with open("foo") as f: f.read() (But it could be a file write, a DNS lookup, any number of other I/O operations.) If I interrupt this program while reading (SIGINT), the I/...
Ouzel asked 18/3, 2021 at 18:12

1

Solved

Why is the following empty program exiting on Ctrl + C with 130 on Linux (which is what I suspect, because my shell bash wraps SIGINT to 130 (128+2). On Windows with Git Bash (git-bash.exe), I get ...
Rasbora asked 22/2, 2021 at 18:25

5

I have setup a run configuration in Eclipse and need to send SIGINT (Ctrl+C) to the program. There is cleanup code in the program that runs after SIGINT, so pressing Eclipse's "Terminate" buttons w...
Stratigraphy asked 11/1, 2012 at 5:1

3

Solved

My python script intercepts the SIGINT signal with the signal process module to prevent premature exit, but this signal is passed to a subprocess that I open with Popen. is there some way to preven...
Fizzy asked 12/7, 2010 at 21:57

1

Solved

I'm writing a monitor service in Python that monitors another service and while the monitor & scheduling part works fine, I have a hard time figuring out how to do a proper shutdown of the serv...
Gerbil asked 22/11, 2020 at 12:38

1

I am trying to handle ctrl+c in a shell script. I have code running in a while loop but I am calling the binary from a shell script and running it in the background so when I want to stop the binar...
Conventionalism asked 1/10, 2020 at 16:16

1

I stream data using context manager to close the connection when the program exits. I run my program as a daemon in the background. How can I make the context manager handle the case when the daemo...
Swink asked 29/6, 2020 at 16:38

5

Solved

I am currently working on a wrapper for a dedicated server running in the shell. The wrapper spawns the server process via subprocess and observes and reacts to its output. The dedicated server mu...
Postmeridian asked 18/2, 2011 at 19:39

1

Solved

When I press ctrl+c while a login shell is executing commands, the foreground process gets killed. Who sends the signal? Does TTY-driver send SIGINT to foreground process group directly? Or does t...
Condemn asked 12/2, 2020 at 17:14

2

Solved

I've read every post I could find about how to gracefully handle a script with an asyncio event loop getting terminated with Ctrl-C, and I haven't been able to get any of them to work without print...
Crock asked 1/2, 2018 at 12:33

2

Solved

I know how to create custom signal handlers in Java, Python, Ruby, Perl, and Lisp, thanks to Google and a plethora of tutorials. I can't find online how to create handlers for SIGINT, SIGTERM, HUP,...
Grilse asked 23/2, 2011 at 8:36

4

Solved

I have a PHP command line app with a custom shutdown handler: <?php declare(ticks=1); $shutdownHandler = function () { echo 'Exiting'; exit(); }; pcntl_signal(SIGINT, $shutdownHandler); w...
Troposphere asked 10/4, 2018 at 17:12

© 2022 - 2024 — McMap. All rights reserved.