fix: check error code on build commands
This commit is contained in:
+7
-1
@@ -139,7 +139,13 @@ export class NexeCompiler<T extends NexeOptions = NexeOptions> {
|
||||
stdio: 'ignore'
|
||||
})
|
||||
.once('error', reject)
|
||||
.once('close', resolve)
|
||||
.once('close', (code: number) => {
|
||||
if (code != 0) {
|
||||
const error = `${command} ${args.join(' ')} exited with code: ${code}`
|
||||
reject(new Error(error))
|
||||
}
|
||||
resolve()
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
+5
-3
@@ -41,8 +41,6 @@ export default async function cli(compiler: NexeCompiler, next: () => Promise<vo
|
||||
|
||||
await next()
|
||||
|
||||
log.step(`Bundling: '${stdInUsed ? '[stdin]' : compiler.options.input}'`)
|
||||
|
||||
const target = compiler.options.targets.shift() as NexeTarget
|
||||
const deliverable = await compiler.compileAsync(target)
|
||||
|
||||
@@ -56,7 +54,11 @@ export default async function cli(compiler: NexeCompiler, next: () => Promise<vo
|
||||
reject(e)
|
||||
} else if (compiler.output) {
|
||||
chmodSync(compiler.output, '755')
|
||||
step.log(`Executable written to: ${compiler.output}`)
|
||||
step.log(
|
||||
`Entry: '${stdInUsed
|
||||
? '[stdin]'
|
||||
: compiler.options.input}' written to: ${compiler.output}`
|
||||
)
|
||||
resolve(compiler.quit())
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user