summaryrefslogtreecommitdiffstats
path: root/src/utils.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils.ts')
-rw-r--r--src/utils.ts17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/utils.ts b/src/utils.ts
index b9b5cfa..fd8a26d 100644
--- a/src/utils.ts
+++ b/src/utils.ts
@@ -1,10 +1,25 @@
+import { exec } from "child_process";
+
+export const asyncExec = (command: string) => {
+ return new Promise<{ stdout: string; stderr: string }>((resolve, reject) => {
+ exec(command, (error, stdout, stderr) => {
+ if (error) {
+ console.error(`exec error: ${error}`);
+ reject(error);
+ } else {
+ resolve({ stdout, stderr });
+ }
+ });
+ });
+};
+
export const wait = (ms: number) =>
new Promise((resolve) => setTimeout(resolve, ms));
export const runWithRetries = async <T>(
fn: () => Promise<T>,
retries: number,
- backoff: number = 2000
+ backoff: number = 2000,
): Promise<T> => {
let attempts = 0;
while (true) {