MCPcopy
hub / github.com/Dokploy/dokploy / execAsync

Function execAsync

packages/server/src/utils/process/execAsync.ts:12–41  ·  view source on GitHub ↗
(
	command: string,
	options?: { cwd?: string; env?: NodeJS.ProcessEnv; shell?: string },
)

Source from the content-addressed store, hash-verified

10const execAsyncBase = util.promisify(exec);
11
12export const execAsync = async (
13 command: string,
14 options?: { cwd?: string; env?: NodeJS.ProcessEnv; shell?: string },
15): Promise<{ stdout: string; stderr: string }> => {
16 try {
17 const result = await execAsyncBase(command, options);
18 return {
19 stdout: result.stdout.toString(),
20 stderr: result.stderr.toString(),
21 };
22 } catch (error) {
23 if (error instanceof Error) {
24 // @ts-ignore - exec error has these properties
25 const exitCode = error.code;
26 // @ts-ignore
27 const stdout = error.stdout?.toString() || "";
28 // @ts-ignore
29 const stderr = error.stderr?.toString() || "";
30
31 throw new ExecError(`Command execution failed: ${error.message}`, {
32 command,
33 stdout,
34 stderr,
35 exitCode,
36 originalError: error,
37 });
38 }
39 throw error;
40 }
41};
42
43interface ExecOptions {
44 cwd?: string;

Callers 15

checkGpuDriverFunction · 0.90
checkRuntimeFunction · 0.90
checkSwarmResourcesFunction · 0.90
checkGpuInfoFunction · 0.90
checkCudaSupportFunction · 0.90
getNodeIdFunction · 0.90
setupLocalServerFunction · 0.90
addGpuLabelFunction · 0.90
verifySetupFunction · 0.90
restoreMySqlBackupFunction · 0.90
restoreMongoBackupFunction · 0.90
restoreWebServerBackupFunction · 0.90

Calls

no outgoing calls

Tested by 3

createMockDeploymentFunction · 0.72
cleanupDockerFunction · 0.72
cleanupFilesFunction · 0.72