Results 1 to 7 of 7

Thread: Killing QProcess shell script

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Aug 2016
    Posts
    4
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Killing QProcess shell script

    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.
    Qt Code:
    1. QString rx_path = QCoreApplication::applicationDirPath();
    2. command = "trap 'exit;' 2; cd " + rx_path + "/applications/bin/ && ./application -udp 42003";
    3. rx_process = new QProcess;
    4. 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.
    Last edited by mister_m; 18th August 2016 at 17:33.

Similar Threads

  1. Replies: 1
    Last Post: 18th November 2014, 18:18
  2. Replies: 4
    Last Post: 22nd April 2014, 15:34
  3. Killing programs started with QProcess
    By AndresBarbaRoja in forum Newbie
    Replies: 0
    Last Post: 1st June 2011, 08:12
  4. QProcess: how to run shell script with password?
    By cutie.monkey in forum Qt Programming
    Replies: 0
    Last Post: 23rd March 2010, 05:43
  5. Call script shell with Qt
    By zeeb100 in forum Qt Programming
    Replies: 6
    Last Post: 26th February 2009, 09:17

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.