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

Stop subshell with background process from receiving SIGINT despite trapping signals in the foreground

Let us say I have a function that is run in the foreground. This function traps SIGINT and ignores EOF (for preventing Control + C and Control + D). This function creates a subshell that runs a command in the background. I would think that SIGINT…
Gigi Bayte 2
  • 838
  • 1
  • 8
  • 20
-1
votes
2 answers

is there a way to print the stacktrace of the current JS line when I ctrl+c in terminal?

I want my javascript to print a stack trace when I force close, so that I know where a function is hanging for instance. Is there a way to do this? I run the code with Node, specifically npx ts-node code.ts. I imagine hijacking sigint might work,…
John Targaryen
  • 1,109
  • 1
  • 13
  • 29
-1
votes
2 answers

Signal Handling (c++)

I have this simple code that loops the word "SIGNALS ARE COOL" I'm trying to make it take signals like (SIGFPE. SIGABRT, SIGINT, SIGSEGV.) and show the signal type and the time I made this code that takes "SIGINT" signal how do I add more signals…
Hade Zedan
  • 21
  • 2
-1
votes
1 answer

How to avoid python exception in while handling SIGINT

import signal import time def sigint_handler(signum, frame): print 'User pressed CTRL+C!' signal.signal(signal.SIGINT, sigint_handler) def main(): while True: print 'Script to handle SIGINT' time.sleep(2) ########## if…
Vignesh T
  • 1
  • 4
-1
votes
1 answer

print a string when the SIGINT signal is ignored

I was asked to write a program which will ignore the SIGINT signal and print a message as well, saying it has been ignored. This is what i came up with after referring the man page for signal and sigaction. //set struct action to ignore signal …
thunderbird
  • 2,715
  • 5
  • 27
  • 51
-2
votes
1 answer

How to properly handle signals in C

I have really really simple program in C, let me cope paste it from internet there: #include #include #include #include void sigint_handler(int dummy) { printf("SIGINT HANDLED!\n"); …
ogarogar
  • 323
  • 2
  • 14
-2
votes
1 answer

why my signal handler is not working using sigaction function?

I was trying following signal handler program , referring from an online tutorial , but it does not seems working , what is wrong with my code: #include #include #include #include #include typedef…
pankaj kushwaha
  • 369
  • 5
  • 20
-3
votes
1 answer

handling SIGINT (ctrl-c) in golang to convert it to a panic

My goal is to have a handler for SIGINT (i.e., Ctrl-C on the CLI) which will allow deferred function calls to run instead of causing a hard exit. The usecase for this is in a test suite with very long-running tests, I want the CLI user to be able to…
lachrimae
  • 79
  • 7
-3
votes
1 answer

Cause gets() to exit on SIGINT in C

I am writing a simple C program which reads one line of text at a time from the keyboard (in a loop) using the gets() function. The loop must exit immediately if the user presses CTRL-C. I know how to write a sig handler which can set a flag to…
TSG
  • 4,242
  • 9
  • 61
  • 121
1 2 3
24
25