Skip to content

Commit 4764a53

Browse files
PetarKirovmonyarm
authored andcommitted
feat(mcl.utils.process): Add spawnProcessInline function
1 parent c1ac864 commit 4764a53

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

packages/mcl/src/src/mcl/utils/process.d

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,3 +61,19 @@ unittest
6161
assert(execute(["true"]) == "");
6262
// assertThrown(execute(["false"]), "Command `false` failed with status 1");
6363
}
64+
65+
void spawnProcessInline(string[] args)
66+
{
67+
import std.logger : tracef;
68+
import std.exception : enforce;
69+
import std.process : spawnProcess, wait;
70+
71+
const bold = "\033[1m";
72+
const normal = "\033[0m";
73+
74+
75+
tracef("$ %s%-(%s %)%s", bold, args, normal);
76+
77+
auto pid = spawnProcess(args);
78+
enforce(wait(pid) == 0, "Process failed.");
79+
}

0 commit comments

Comments
 (0)