mirror of
https://github.com/djdevin/recflare.git
synced 2026-09-09 15:11:29 -07:00
Initial commit
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
import type { ProcessOutput } from 'zx'
|
||||
|
||||
export function onProcSuccess(
|
||||
name: string,
|
||||
resolve: (value: unknown) => void,
|
||||
reject: (reason?: unknown) => void
|
||||
) {
|
||||
return (proc: ProcessOutput) => {
|
||||
if (proc.exitCode === 0) {
|
||||
resolve(`${name} ran correctly`)
|
||||
} else {
|
||||
reject(`${name} exited with ${proc.exitCode}`)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export function catchError(reject: (reason?: unknown) => void) {
|
||||
return () => reject('unknown error')
|
||||
}
|
||||
Reference in New Issue
Block a user