diff options
Diffstat (limited to 'src/corelib/io')
-rw-r--r-- | src/corelib/io/qprocess_unix.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/corelib/io/qprocess_unix.cpp b/src/corelib/io/qprocess_unix.cpp index 1179373cf3..ca65a3c776 100644 --- a/src/corelib/io/qprocess_unix.cpp +++ b/src/corelib/io/qprocess_unix.cpp @@ -256,15 +256,6 @@ struct QChildProcess : d(d), argv(resolveExecutable(d->program), d->arguments), envp(d->environmentPrivate()) { - if (!d->workingDirectory.isEmpty()) { - workingDirectory = opendirfd(QFile::encodeName(d->workingDirectory)); - if (workingDirectory < 0) { - d->setErrorAndEmit(QProcess::FailedToStart, "chdir: "_L1 + qt_error_string()); - d->cleanup(); - return; - } - } - // Block Unix signals, to ensure the user's handlers aren't run in the // child side and do something weird, especially if the handler and the // user of QProcess are completely different codebases. @@ -276,6 +267,15 @@ struct QChildProcess // would be bad enough with regular fork(), but it's likely fatal with // vfork(). disableThreadCancellations(); + + if (!d->workingDirectory.isEmpty()) { + workingDirectory = opendirfd(QFile::encodeName(d->workingDirectory)); + if (workingDirectory < 0) { + d->setErrorAndEmit(QProcess::FailedToStart, "chdir: "_L1 + qt_error_string()); + d->cleanup(); + } + } + } ~QChildProcess() noexcept(false) { |