MCPcopy Index your code
hub / github.com/devcontainers/cli / exec

Function exec

src/spec-common/shellServer.ts:53–70  ·  view source on GitHub ↗
(cmd: PlatformSwitch<string>, options?: { logLevel?: LogLevel; logOutput?: boolean | 'continuous' | 'silent'; stdin?: Buffer })

Source from the content-addressed store, hash-verified

51
52 let lastExec: Promise<any> | undefined;
53 async function exec(cmd: PlatformSwitch<string>, options?: { logLevel?: LogLevel; logOutput?: boolean | 'continuous' | 'silent'; stdin?: Buffer }) {
54 const currentExec = lastExec = (async () => {
55 try {
56 await lastExec;
57 } catch (err) {
58 // ignore
59 }
60 return _exec(platformDispatch(platform, cmd), options);
61 })();
62 try {
63 return await Promise.race([currentExec, monitor.unexpectedExit]);
64 } finally {
65 monitor.disposeStdioListeners();
66 if (lastExec === currentExec) {
67 lastExec = undefined;
68 }
69 }
70 }
71
72 async function _exec(cmd: string, options?: { logLevel?: LogLevel; logOutput?: boolean | 'continuous' | 'silent'; stdin?: Buffer }) {
73 const text = `Run in ${hostName.toLowerCase()}: ${cmd.replace(/\n.*/g, '')}`;

Callers 3

runCommandNoPtyFunction · 0.70
getEventsFunction · 0.50
dockerExecFunctionFunction · 0.50

Calls 2

platformDispatchFunction · 0.90
_execFunction · 0.85

Tested by

no test coverage detected