146#if qStroika_Foundation_Common_Platform_Windows
147 CommandLine::WrapInShell::eWindowsCMD
149 CommandLine::WrapInShell::eBash
162 optional<filesystem::path> fWorkingDirectory;
189 bool fDetached{
false};
191#if qStroika_Foundation_Common_Platform_POSIX
197 optional<mode_t> fChildUMask{027};
200#if qStroika_Foundation_Common_Platform_Windows
205 bool fCreateNoWindow : 1 {
true};
224#if qCompilerAndStdLib_DefaultMemberInitializerNeededEnclosingForDefaultFunArg_Buggy
234 ProcessRunner (
const String& commandLine,
const Options& o = {});
241#if qStroika_Foundation_Common_Platform_POSIX
242 using ExitStatusType = uint8_t;
243#elif qStroika_Foundation_Common_Platform_Windows
244 using ExitStatusType = DWORD;
246 using ExitStatusType = int;
255 nonvirtual CommandLine GetCommandLine ()
const;
256 nonvirtual
void SetCommandLine (
const CommandLine& args);
261 nonvirtual Options GetOptions ()
const;
262 nonvirtual
void SetOptions (
const Options& o);
271 optional<ExitStatusType> fExitStatus;
272 optional<SignalID> fTerminatedByUncaughtSignalNumber;
279 nonvirtual
String ToString ()
const;
353 nonvirtual tuple<Characters::String, Characters::String>
Run (
const Characters::String& cmdStdInValue =
""sv,
358 class BackgroundProcess;
383 nonvirtual function<void ()> CreateSimpleRunnable_ ();
390 struct DetailedRunnableRep_ {
408 nonvirtual tuple<function<void ()>, shared_ptr<DetailedRunnableRep_>> CreateDetailedRunnable_ ();
411#if qStroika_Foundation_Common_Platform_POSIX
412 static void Process_Runner_POSIX_ (
const shared_ptr<DetailedRunnableRep_>& runneeDetails,
413 [[maybe_unused]]
const optional<filesystem::path>& executable,
const CommandLine& cmdLine,
416#elif qStroika_Foundation_Common_Platform_Windows
417 static void Process_Runner_Windows_ (
const shared_ptr<DetailedRunnableRep_>& runneeDetails,
418 const optional<filesystem::path>& executable,
const CommandLine& cmdLine,
424 optional<filesystem::path> fExecutable_;
433 [[deprecated (
"Since Stroika v3.0d12 - pass stdin/stdout/stderr to ProcessRunner Run() method (if needed)")]]
ProcessRunner (
436 [[deprecated (
"Since Stroika v3.0d12 - pass stdin/stdout/stderr to ProcessRunner Run() method (if needed)")]]
ProcessRunner (
439 [[deprecated (
"Since Stroika v3.0d12 - pass stdin/stdout/stderr to ProcessRunner Run() method (if needed)")]]
ProcessRunner (
445 this->fStdOut_ = out;
446 this->fStdErr_ = error;
449 [[deprecated (
"Since Stroika v3.0d12 - use other overloads for ProcessRunner")]]
ProcessRunner (
455 this->fStdOut_ = out;
456 this->fStdErr_ = error;
459 [[deprecated (
"Since Stroika v3.0d12 - pass in/out/error streams(can be nullptr) to Run method instead of CTOR")]]
void
460 Run (optional<ProcessResultType>* processResult, ProgressMonitor::Updater progress =
nullptr,
Time::DurationSeconds timeout = Time::kInfinity);
462 [[deprecated (
"Since Stroika v3.0d12 pass in/out/error(can be nullptr) in RunInbackground() method")]] BackgroundProcess
468 [[maybe_unused]] ProgressMonitor::Updater progress);
475 [[deprecated (
"Since Stroika v3.0d23d")]] tuple<Characters::String, Characters::String>
476 Run (
const Characters::String& cmdStdInValue,
const StringOptions& stringOpts, ProgressMonitor::Updater progress,
482 [[deprecated (
"Since Stroika v3.0d12 - use GetOptions().fWorkingDirectory")]] optional<filesystem::path> GetWorkingDirectory ()
const;
483 [[deprecated (
"Since Stroika v3.0d12 - use SetOptions({.fWorkingDirectory})")]]
void SetWorkingDirectory (
const optional<filesystem::path>& d);
494 [[deprecated (
"Since Stroika v3.0d12 - pass in/out/error streams(can be nullptr) to Run method instead of CTOR")]]
void
503 [[deprecated (
"Since Stroika v3.0d12 - pass in/out/error streams(can be nullptr) to Run method instead of CTOR")]]
void
512 [[deprecated (
"Since Stroika v3.0d12 - pass in/out/error streams(can be nullptr) to Run method instead of CTOR")]]
void
526 Exception (
const String& failureMessage,
const optional<String>& stderrFragment = nullopt,
527 const optional<ExitStatusType>& wExitStatus = nullopt,
const optional<SignalID>& wTermSig = nullopt);
536 const optional<String> fStderrFragment;
539 const optional<ExitStatusType> fExitStatus;
542 const optional<SignalID> fTermSignal;
545 static String mkMsg_ (
const String& errorMessage,
const optional<String>& stderrSubset,
const optional<ExitStatusType>& wExitStatus,
546 const optional<SignalID>& wTermSig);
633 virtual ~Rep_ () =
default;
635 shared_ptr<DetailedRunnableRep_> fDetailedRunnableRep_;
637 shared_ptr<Rep_> fRep_;
nonvirtual void Run(const Streams::InputStream::Ptr< byte > &in, const Streams::OutputStream::Ptr< byte > &out=nullptr, const Streams::OutputStream::Ptr< byte > &error=nullptr, Time::DurationSeconds timeout=Time::kInfinity)
Run the given external command/process (set by constructor) - with the given arguments,...
nonvirtual BackgroundProcess RunInBackground(const Streams::InputStream::Ptr< byte > &in=nullptr, const Streams::OutputStream::Ptr< byte > &out=nullptr, const Streams::OutputStream::Ptr< byte > &error=nullptr)
Run the given external command/process (set by constructor) - with the given arguments in the backgro...