Process.copy

Copy the process configuration. Could be useful when needed to run command multipe times with slightly different configuration. Returns new instance of process.

struct Process
const
copy
()

Examples

Ensure that copy, setArgs, addArgs, and withArgs work correctly

import unit_threaded.assertions;

auto p = Process("some-test-program").withArgs("arg1", "arg2");
p._args.should == ["arg1", "arg2"];

// setArgs mutates in place (void return)
p.setArgs("arg3", "arg4");
p._args.should == ["arg3", "arg4"];

// addArgs mutates in place (void return)
p.addArgs("arg4b");
p._args.should == ["arg3", "arg4", "arg4b"];

// withArgs returns a new Process with args appended, without modifying the original
auto p2 = p.withArgs("arg5", "arg6");
p2._args.should == ["arg3", "arg4", "arg4b", "arg5", "arg6"];
p._args.should == ["arg3", "arg4", "arg4b"];

// withArgs on a fresh process works as expected (append to empty = set)
auto p3 = Process("other-program").withArgs("arg7");
p3._args.should == ["arg7"];

Meta