| 22 | //------------------------------------------------------------------------------------------------------- |
| 23 | |
| 24 | SC::Result SC::ProcessChain::internalLaunch(const Process::StdOut& stdOut, const Process::StdIn& stdIn, |
| 25 | const Process::StdErr& stdErr) |
| 26 | { |
| 27 | if (processes.isEmpty()) |
| 28 | { |
| 29 | return Result::Error("ProcessChain::launch - No Processes"); |
| 30 | } |
| 31 | for (Process* process = processes.front; process != nullptr; process = process->next) |
| 32 | { |
| 33 | process->options = options; |
| 34 | if (process == processes.front) |
| 35 | { |
| 36 | if (process == processes.back) |
| 37 | { |
| 38 | // single item in the list |
| 39 | SC_TRY(process->launch(stdOut, stdIn, stdErr)); |
| 40 | } |
| 41 | else |
| 42 | { |
| 43 | // stdout and stderr are chained from previous process |
| 44 | SC_TRY(process->launch(Process::StdOut::AlreadySetup(), stdIn, Process::StdErr::AlreadySetup())); |
| 45 | } |
| 46 | } |
| 47 | else if (process == processes.back) |
| 48 | { |
| 49 | // Gets stdin from previous process in the chain |
| 50 | SC_TRY(process->launch(stdOut, Process::StdIn::AlreadySetup(), stdErr)); |
| 51 | } |
| 52 | else |
| 53 | { |
| 54 | // Use directly launchImplementation as we've already setup redirection manually |
| 55 | SC_TRY(process->launchImplementation()); |
| 56 | } |
| 57 | } |
| 58 | return Result(true); |
| 59 | } |
| 60 | |
| 61 | SC::Result SC::ProcessChain::pipe(Process& process, const Span<const StringSpan> cmd) |
| 62 | { |
nothing calls this directly
no test coverage detected