Results 1 to 2 of 2

Thread: Ignoring stdout and stder of detached process

  1. #1
    Join Date
    Jul 2012
    Posts
    10
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Ignoring stdout and stder of detached process

    Hi. I've got some troubles with debugging my app. I'm running new process with QProcess::startDetached (command), but it gives a lot of logs. I don't need them, so my question is - how can i disable printing stdoutput and stderror of this new process? I've tried:

    Qt Code:
    1. QProcess newprocess
    2. newprocess.startDetached ("xscreensaver-command -deactivate");
    3. newprocess.CloseReadChannel(newprocess.StandartError());
    4. newprocess.CloseReadChannel(newprocess.StandartOutput());
    To copy to clipboard, switch view to plain text mode 

    But it doesn't work. xcreensaver prints his warning about running statement.

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Ignoring stdout and stder of detached process

    QProcess::startDetatched() is static, so the newProcess instance has no relationship to the process you started. So, even if the things you've "tried" would compile (they won't) they would not change the launched process.

    Since the command you are running is short lived you can just start it and ignore its output. Try:
    Qt Code:
    1. p.start("xscreensaver-command", QStringList() << "-deactivate");
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. Ignoring keyboard events in QwtPlotPicker
    By frankiefrank in forum Qwt
    Replies: 4
    Last Post: 23rd January 2012, 11:45
  2. Qt IGNORING SOURCE CODE
    By Rakula in forum Qt for Embedded and Mobile
    Replies: 1
    Last Post: 1st November 2010, 13:35
  3. GraphicsView ignoring clicks on some objects
    By mooreaa in forum Qt Programming
    Replies: 4
    Last Post: 1st July 2008, 08:59
  4. Positioning Detached Process Window
    By GTBuilder in forum Qt Programming
    Replies: 2
    Last Post: 10th March 2008, 00:17
  5. Information From Detached Process
    By GTBuilder in forum Qt Programming
    Replies: 6
    Last Post: 18th February 2008, 14:49

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.