On 07/04/13 20:41, Tommaso Cucinotta wrote:
> they are fed to SystemcallPrivate() which elegantly ignores the stderr file:
> 
>               if (err_file_ != os::nulldev()) {
>                       printf("Calling 
> QProcess::setStandardErrorFile(\"%s\")\n", err_file_.c_str());
>                       process_->setStandardErrorFile(QString::fromLocal8Bit(
>                                                       err_file_.c_str()));
>               }

I now realize why there's so much of creating these tmpf files then deleting 
them wastefully in VCBackend.cpp, e.g., in SVN::findFile() [1], because stdout 
redirection to /dev/null has exactly the same problem. I can't believe we can't 
just redirect to /dev/null on Linux, but we have to go through all of this! Can 
we at least hide all this stuff within doVCCommandCall(), and perhaps 
ultimately within SystemcallPrivate() constructor ? As it's already designed to 
intercept /dev/null on stdout and stderr, it's sufficient to add the trick 
straight there -- create a tmp file, redirect to it, then remember to remove it 
in the destructor?

Are we sure we can't simply set the output/err files to os::nulldev() ("nul" 
for Win and "/dev/null" everywhere else), to suppress them ?

        T.

[1]
        // Now we check the status of the file.
        FileName tmpf = FileName::tempName("lyxvcout");
        if (tmpf.empty()) {
                LYXERR(Debug::LYXVC, "Could not generate logfile " << tmpf);
                return FileName();
        }

        string const fname = onlyFileName(file.absFileName());
        LYXERR(Debug::LYXVC, "LyXVC: Checking if file is under svn control for 
`" << fname << '\'');
        bool found = 0 == doVCCommandCall("svn info " + quoteName(fname)
                                                + " > " + 
quoteName(tmpf.toFilesystemEncoding()),
                                                file.onlyPath());
        tmpf.removeFile();

Reply via email to