diff options
Diffstat (limited to 'src/utils')
| -rw-r--r-- | src/utils/helper.ts | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/utils/helper.ts b/src/utils/helper.ts new file mode 100644 index 0000000..379aeef --- /dev/null +++ b/src/utils/helper.ts @@ -0,0 +1,15 @@ +import { exec, type ExecException } from "child_process"; + +export async function pullLatest(path: string) { + await promiseExec(`cd "${path}" && git pull`); +} + +export function promiseExec( + cmd: string, +): Promise<{ error: ExecException | null; stdout: string; stderr: string }> { + return new Promise((resolve, _) => { + exec(cmd, (error, stdout, stderr) => { + resolve({ error, stdout, stderr }); + }); + }); +} |
