Skip to content

Commit

Permalink
Update utils
Browse files Browse the repository at this point in the history
  • Loading branch information
billytrend-cohere committed Oct 28, 2024
1 parent 5448918 commit d87cf5c
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions packages/snippet-tester/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,16 @@ export const findAndReplace = async (paths: string[], find: RegExp, replace: str

export const execCmd = async (cmd: string, cwd: string): Promise<{error: null | childProcess.ExecException, stderr: string, stdout: string}> => {
return new Promise((resolve, reject) => {
childProcess.exec(cmd, {cwd}, (error, stdout, stderr) => {
if (error) {
reject({error, stderr, stdout})
}
resolve({ error, stderr, stdout})
})
try {
childProcess.exec(cmd, {cwd}, (error, stdout, stderr) => {
if (error) {
resolve({error, stderr, stdout})
}
resolve({ error, stderr, stdout})
})
} catch (error) {
resolve({error, stderr: '', stdout: ''})
}
})
}

Expand Down

0 comments on commit d87cf5c

Please sign in to comment.