0

My C++ app launches a QProcess, and after 60 seconds kills the process (if it runs too long). So that part is fine, but on the console I see:

QProcess: Destroyed while process ("myapp") is still running.

when the QProcess is killed. Is there some way to suppress this message? This isn't an error requiring notification of the user.

TSG
  • 4,242
  • 9
  • 61
  • 121
  • Implement the appropriate code in your process to perform an orderly termination, when so externally signalled. Perhaps use a socket for that, or something similar. Alternatively installed a signal handler for `SIGTERM` that does an immediate `_exit(0)`, or, perhaps, redirect its standard error to `/dev/null`. – Sam Varshavchik Mar 24 '18 at 23:49
  • The 'myapp' is written by a third party - so I can't change how it acts. – TSG Mar 24 '18 at 23:55
  • But you can redirect its standard error to `/dev/null`. – Sam Varshavchik Mar 25 '18 at 00:01
  • Is the child process generating that output, or is your program? – Miles Budnek Mar 25 '18 at 00:03
  • I think my process, which creates the QProcess object, is generating the output. Something in the Qt library (which implements QProcess) is doing this. I don't want it too - the folks at Qt must think this is a good thing. And just to be clear, my program captures stdout and stderr, so the Qt library is writing this. – TSG Mar 25 '18 at 00:05

1 Answers1

0

It looks like that message comes from QProcess's destructor if the child process is still running when the QProcess object is destroyed. The solution is therefore to kill the child process before destroying the QProcess object.

Miles Budnek
  • 28,216
  • 2
  • 35
  • 52