| 90 | } |
| 91 | |
| 92 | export async function docker( |
| 93 | command: string, |
| 94 | options: string[] = [], |
| 95 | input?: string, |
| 96 | ) { |
| 97 | return new Promise<{ stdout: string; stderr: string }>((resolve, reject) => { |
| 98 | const childProccess = exec( |
| 99 | `docker ${command} ${options.join(" ")}`, |
| 100 | (error, stdout, stderr) => { |
| 101 | if (error) { |
| 102 | reject({ error, stdout, stderr }); |
| 103 | return; |
| 104 | } |
| 105 | resolve({ stdout, stderr }); |
| 106 | }, |
| 107 | ); |
| 108 | if (input) { |
| 109 | childProccess.stdin?.write(input); |
| 110 | childProccess.stdin?.end(); |
| 111 | } |
| 112 | }); |
| 113 | } |
| 114 | |
| 115 | export async function mzcompose(command: string, input?: string) { |
| 116 | return new Promise<{ stdout: string; stderr: string }>((resolve, reject) => { |