Hey all,
First time poster on these forums. Quick question.
I'm running a simple shell command line from QProcess; Both the shell and application i'm running are designed to close on a interrupt signal. However, I'm having the shell application lingering around in system monitor after i call QProcess->Close() and QApplication::quit(). I'm guessing it has to do with how QT sends signals.
Some code.
command = "trap 'exit;' 2; cd " + rx_path + "/applications/bin/ && ./application -udp 42003";
rx_process
->start
("sh",
QStringList() <<
"-c" << command
);
QString rx_path = QCoreApplication::applicationDirPath();
command = "trap 'exit;' 2; cd " + rx_path + "/applications/bin/ && ./application -udp 42003";
rx_process = new QProcess;
rx_process->start("sh",QStringList() << "-c" << command);
To copy to clipboard, switch view to plain text mode
trap 2 = SIGINT
This launches application with the correct flags, but i'll still see application in system monitor, many instances of it for every time i run my QT application.
I've also tried "trap 'exit;' INT; . . . ." and "trap 'exit;' SIGINT . . . " SIGINT returns bad trap. IIRC close() sends SIGINT. I've also tried kill() and terminate().
Kinda running out of ideas, maybe i'm doing something wrong. Is there a way to manually send Ctrl+C to my sh?
If i run "trap 'exit;' 2; cd " + rx_path + "/applications/bin/ && ./application -udp 42003" from terminal it exits out of both my application and the shell properly.
Bookmarks