0

I have a QProcess where I am not able to discard the Output on a Windows Machine:

QProcess * pingProcess = new QProcess;

arguments "google.com" << "-n" << "1";

pingProcess->setStandardOutputFile(pingProcess->nullDevice());
pingProcess->setStandardErrorFile(pingProcess->nullDevice());
pingProcess->setProcessChannelMode(QProcess::SeparateChannels); 

int exitCode = pingProcess->execute("ping",arguments);

I still have the Output of the ping in the command line

Any idea?

nop_0x00
  • 33
  • 7
  • You're running the executable by calling [`QProcess::execute`](http://doc.qt.io/qt-5/qprocess.html#execute). That's a `static` member and its behaviour is probably unaffected by any previous calls to `QProcess::setStandardOutputFile` etc. Try running the executable using [`QProcess::start`](http://doc.qt.io/qt-5/qprocess.html#start-1) instead, i.e.`pingProcess->start("ping", arguments)`. – G.M. Nov 16 '17 at 10:42
  • Thanks, it is working. I just had to add a callback to retrieve the exit code. connect(pingProcess, SIGNAL(finished(int , QProcess::ExitStatus )), this, SLOT(ping_process_cb(int , QProcess::ExitStatus ))); – nop_0x00 Nov 17 '17 at 09:31

0 Answers0