File tree Expand file tree Collapse file tree 3 files changed +17
-1
lines changed Expand file tree Collapse file tree 3 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -263,7 +263,6 @@ void QuickshellGlobal::execDetached(const qs::io::process::ProcessContext& conte
263263 auto args = context.command .sliced (1 );
264264
265265 QProcess process;
266-
267266 qs::io::process::setupProcessEnvironment (&process, context.clearEnvironment , context.environment );
268267
269268 if (!context.workingDirectory .isEmpty ()) {
@@ -272,6 +271,14 @@ void QuickshellGlobal::execDetached(const qs::io::process::ProcessContext& conte
272271
273272 process.setProgram (cmd);
274273 process.setArguments (args);
274+
275+ process.setStandardInputFile (QProcess::nullDevice ());
276+
277+ if (context.unbindStdout ) {
278+ process.setStandardOutputFile (QProcess::nullDevice ());
279+ process.setStandardErrorFile (QProcess::nullDevice ());
280+ }
281+
275282 process.startDetached ();
276283}
277284
Original file line number Diff line number Diff line change @@ -249,6 +249,11 @@ void Process::startDetached() {
249249 this ->setupEnvironment (&process);
250250 process.setProgram (cmd);
251251 process.setArguments (args);
252+
253+ process.setStandardInputFile (QProcess::nullDevice ());
254+ process.setStandardOutputFile (QProcess::nullDevice ());
255+ process.setStandardErrorFile (QProcess::nullDevice ());
256+
252257 process.startDetached ();
253258}
254259
Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ class ProcessContext {
1616 Q_PROPERTY (QHash<QString, QVariant> environment MEMBER environment WRITE setEnvironment);
1717 Q_PROPERTY (bool clearEnvironment MEMBER clearEnvironment WRITE setClearEnvironment);
1818 Q_PROPERTY (QString workingDirectory MEMBER workingDirectory WRITE setWorkingDirectory);
19+ Q_PROPERTY (bool unbindStdout MEMBER unbindStdout WRITE setUnbindStdout);
1920 Q_GADGET;
2021 QML_STRUCTURED_VALUE;
2122 QML_VALUE_TYPE (processContext);
@@ -45,6 +46,8 @@ class ProcessContext {
4546 this ->workingDirectorySet = true ;
4647 }
4748
49+ void setUnbindStdout (bool unbindStdout) { this ->unbindStdout = unbindStdout; }
50+
4851 QList<QString> command;
4952 QHash<QString, QVariant> environment;
5053 bool clearEnvironment = false ;
@@ -54,6 +57,7 @@ class ProcessContext {
5457 bool environmentSet : 1 = false ;
5558 bool clearEnvironmentSet : 1 = false ;
5659 bool workingDirectorySet : 1 = false ;
60+ bool unbindStdout : 1 = true ;
5761};
5862
5963void setupProcessEnvironment (
You can’t perform that action at this time.
0 commit comments