MCPcopy
hub / github.com/toeverything/AFFiNE / execAsync

Function execAsync

tools/utils/src/process.ts:67–87  ·  view source on GitHub ↗
(
  tag: string,
  cmd: string | string[],
  options?: SpawnOptions
)

Source from the content-addressed store, hash-verified

65}
66
67export function execAsync(
68 tag: string,
69 cmd: string | string[],
70 options?: SpawnOptions
71): Promise<void> {
72 return new Promise((resolve, reject) => {
73 const childProcess = spawn(tag, cmd, options);
74
75 childProcess.once('error', e => {
76 reject(e);
77 });
78
79 childProcess.once('exit', code => {
80 if (code === 0) {
81 resolve();
82 } else {
83 reject(new Error(`Child process exits with non-zero code ${code}`));
84 }
85 });
86 });
87}
88
89export function exec(
90 tag: string,

Callers 1

runCommandMethod · 0.90

Calls 4

spawnFunction · 0.85
rejectFunction · 0.85
resolveFunction · 0.85
onceMethod · 0.80

Tested by

no test coverage detected