I'm trying to write a shell and I'm at the point where I want to ignore ctrl-c.
I currently have my program ignoring SIGINT and printing a new line when the signal comes, but how can I prevent the ^C from being printed?
When pressing ctrl-c, here is what I get:
myshell>^C
myshell>^C
myshell>^C
but I want:
myshell>
myshell>
myshell>...
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 application cleanly).
Is it possible on Windows to send a Ctrl-C/SIGINT/equivalent to a process from another (unrelated) process to request that...
I've got a python script managing a gdb process on windows, and I need to be able to send a SIGINT to the spawned process in order to halt the target process (managed by gdb)
It appears that there is only SIGTERM available in win32, but clearly if I run gdb from the console and Ctrl+C, it thinks it's receiving a SIGINT. Is there a wa...
Is there a way to stop the inferior without using Ctrl+C (or an equivalent signal sent from another process?) I'm using a windows platform and am managing GDB from another process, so with no notion of signals, it seems that there isn't a good way to break execution of my program when it's free running without any breakpoints.
EDIT FOR...
I have a program running on a remote machine which expects to receive SIGINT from the parent. That program needs to receive that signal to function correctly. Unfortunately, if I run that process remotely over SSH and send SIGINT, the ssh process itself traps and interrupts rather than forwarding the signal.
Here's an example of this be...
I want to use zbarcam but after reading a barcode, it doesn't stop.
$ zbarcam | xvkbd -file - -window emacs
EAN-13:6941428130969
CODE-128:3096140900557
Do you know how I can tell bash to kill zbarcam after printing on the stdout the first \n ?
...
How do I catch a ctrl-c event in C++?
...
I have a program which takes a long time to complete. I would like
it to be able to catch SIGINT (ctrl-c) and call the self.save_work() method.
As it stands, my signal_hander() does not work since
self is not defined by the time the program reaches signal_handler().
How can I set it up so self.save_work gets called after a SIGINT?
#...
I am trying to create a child process and then send SIGINT to the child without terminating the parent. I tried this:
pid=fork();
if (!pid)
{
setpgrp();
cout<<"waiting...\n";
while(1);
}
else
{
cout<<"parent";
wait(NULL);
}
but when I hit C-c both process were terminated
...
I wrote this simple program:
void sig_ha(int signum)
{
cout<<"received SIGINT\n";
}
int main()
{
string name;
struct sigaction newact, old;
newact.sa_handler = sig_ha;
sigemptyset(&newact.sa_mask);
newact.sa_flags = 0;
sigaction(SIGINT,&newact,&old);
for (int i=0;i<5;i++)
{
cout<<"Enter text: ";
getline(cin,name)...
Okay, I am writing a program that is doing some pretty heavy analysis and I would like to be able to stop it quickly.
I added signal(SIGINT, terminate); to the beginning of main and defined terminate like:
void terminate(int param){
cout << endl << endl << "Exit [N]ow, or [A]fter this url?" << endl;
std::string answer;
cin >> ...
#include<stdio.h>
#include<signal.h>
void handler(int signo)
{
printf("Into handler\n");
while(1);
}
int main()
{
struct sigaction act;
act.sa_handler = handler;
act.sa_flags = 0;
sigemptyset(& act.sa_mask);
sigaction(SIGINT, &act, NULL);
while(1);
return 0;
}
After catching the KeyboardInterrupt on...
Hello,
I am trying to terminate an openvpn task, spawned via NSTask.
My question:
Should I send ctrl+c (SIGINT) to the input NSPipe for my NSTask?
inputPipe = [NSPipe pipe];
taskInput = [inputPipe fileHandleForWriting];
NSString dataString = @"\cC";
[taskInput writeData:[dataString dataUsingEncoding: [NSString defaultCStringEncoding]...
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 prevent passing this signal to the subprocess so that it also is not exited prematurely when the user presses ctrl-c?
...
I am using supervisord to spawn and manage a FastCGI application that I am writing in C for a linux target. I have a signal handler that gracefully exits my application when SIGINT is received. I have verified that the signal handler works as desired by running the app in a terminal window and issuing Ctrl-C to exit.
When issuing a "sh...
I have a multithreaded program and use the signal.signal(SIGINT,func) to kill all threads when ctrl c is pressed. The question I have is this:
I have to call signal.signal(...) from main in python. Do I have to call that on a loop or can I just set it once and whenever the user presses ctrl c, the signal will be caught?
...
Hello.
When using threading module and Thread() class, SIGINT (Ctrl+C in console) could not be catched.
Why and what can I do?
Simple test program:
#!/usr/bin/env python
import threading
def test(suffix):
while True:
print "test", suffix
def main():
for i in (1, 2, 3, 4, 5):
threading.Thread(target=test, ar...