MCPcopy Index your code
hub / github.com/dmno-dev/bumpy / runAsync

Function runAsync

packages/bumpy/src/utils/shell.ts:47–66  ·  view source on GitHub ↗
(cmd: string, opts?: { cwd?: string; input?: string })

Source from the content-addressed store, hash-verified

45}
46
47export function runAsync(cmd: string, opts?: { cwd?: string; input?: string }): Promise<string> {
48 const result = checkIntercept(cmd.split(/\s+/), opts);
49 if (result?.intercepted) {
50 if ('error' in result) return Promise.reject(new Error(result.error));
51 return Promise.resolve(result.result);
52 }
53 return new Promise((resolve, reject) => {
54 const child = exec(cmd, { cwd: opts?.cwd, encoding: 'utf-8' }, (err, stdout, stderr) => {
55 if (err) {
56 reject(new Error(`Command failed: ${cmd}\n${stdout}\n${stderr}`.trim()));
57 } else {
58 resolve(stdout.trim());
59 }
60 });
61 if (opts?.input) {
62 child.stdin?.write(opts.input);
63 child.stdin?.end();
64 }
65 });
66}
67
68/**
69 * Run a shell command, streaming its stdout/stderr to the parent process live

Callers 2

shell.test.tsFile · 0.90
checkIfPublishedFunction · 0.85

Calls 1

checkInterceptFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…