QProcess::startDetached and bash stdout capture

David Faure faure at kde.org
Sat Mar 25 21:40:19 GMT 2017


On samedi 25 mars 2017 22:19:22 CET Thiago Macieira wrote:
> On sábado, 25 de março de 2017 09:03:28 PDT David Faure wrote:
> > On samedi 25 mars 2017 16:50:37 CET Thiago Macieira wrote:
> > > One problem is because the launched process inherits the pipes to stdout
> > > and stderr
> > 
> > Really, even with startDetached? I assumed that was more "detached" than
> > that
> 
> But you may want:
> 
> 	int fd = open("/dev/null", O_RDWR);
> 	dup2(fd, STDIN_FILENO);
> 	dup2(fd, STDOUT_FILENO);
> 	dup2(fd, STDERR_FILENO);
> 	close(fd);

Thanks, doing this in the helper fixed the problem!

> Like I said, this may be useful to add as a flag to QProcess::startDetached
> too.

Go ahead, I don't understand this stuff enough to do it myself.

-- 
David Faure, faure at kde.org, http://www.davidfaure.fr
Working on KDE Frameworks 5





More information about the kde-core-devel mailing list