fix: check error code on build commands

This commit is contained in:
calebboyd
2017-09-26 23:54:18 -05:00
parent 11fa087e9d
commit fcb54d9085
2 changed files with 12 additions and 4 deletions
+7 -1
View File
@@ -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
View File
@@ -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())
}
})