1
0
mirror of https://github.com/JuanCanham/HackMyResume.git synced 2025-08-14 20:41:01 +01:00

Finish HackMyCore reshaping.

Reintroduce HackMyCore, dropping the interim submodule, and reorganize
and improve tests.
This commit is contained in:
hacksalot
2016-01-29 15:23:57 -05:00
parent e9971eb882
commit 0f65e4c9f3
130 changed files with 5384 additions and 337 deletions

View File

@@ -0,0 +1,28 @@
###*
Safe spawn utility for HackMyResume / FluentCV.
@module utils/safe-spawn
@license MIT. See LICENSE.md for details.
###
module.exports = ( cmd, args, isSync, callback ) ->
try
# .spawnSync not available on earlier Node.js, so default to .spawn
spawn = require('child_process')[ if isSync then 'spawnSync' else 'spawn'];
info = spawn cmd, args
# Check for error depending on whether we're sync or async
if !isSync
info.on 'error', (err) ->
if callback? then callback err; return
else throw cmd: cmd, inner: err
return
else
if info.error
if callback? then callback err; return
else throw cmd: cmd, inner: info.error
catch
if callback? then callback _error
else throw _error