summaryrefslogtreecommitdiff
path: root/src/utils/helper.ts
blob: 379aeef757d906acfd49900a6b6fb6de97dfc73e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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 });
    });
  });
}