Skip to content

Instantly share code, notes, and snippets.

@dominykas
Last active August 29, 2015 14:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dominykas/f67e139a93fffdeb4c11 to your computer and use it in GitHub Desktop.
Save dominykas/f67e139a93fffdeb4c11 to your computer and use it in GitHub Desktop.
shelljs exec (sync) problems
#!/usr/bin/env bash
cd /tmp
git init tmp
cd tmp
git rev-parse --abbrev-ref HEAD
exit 1
console.log(require("shelljs").exec("./error.sh"));
Initialized empty Git repository in /private/tmp/tmp/.git/
fatal: ambiguous argument 'HEAD': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
HEAD
{ code: 1,
output: 'Initialized empty Git repository in /private/tmp/tmp/.git/\nfatal: ambiguous argument \'HEAD\': unknown revision or path not in the working tree.\nUse \'--\' to separate paths from revisions, like this:\n\'git <command> [<revision>...] -- [<file>...]\'\nHEAD\n' }
Initialized empty Git repository in /tmp/tmp/.git/
events.js:141
throw er; // Unhandled 'error' event
^
Error: write after end
at writeAfterEnd (_stream_writable.js:158:12)
at WriteStream.Writable.write (_stream_writable.js:207:5)
at Socket.ondata (_stream_readable.js:524:20)
at emitOne (events.js:82:20)
at Socket.emit (events.js:166:7)
at readableAddChunk (_stream_readable.js:146:16)
at Socket.Readable.push (_stream_readable.js:109:10)
at Pipe.onread (net.js:517:20)
shell.js: internal error
Error: Command failed: "/home/travis/.nvm/versions/io.js/v1.6.3/bin/iojs" /tmp/shelljs_39e1753021daa2512cff
at checkExecSyncError (child_process.js:1321:13)
at Object.execSync (child_process.js:1361:13)
at execSync (/home/travis/build/dominykas/grunt-checkbranch/node_modules/shelljs/src/exec.js:77:11)
at Object._exec (/home/travis/build/dominykas/grunt-checkbranch/node_modules/shelljs/src/exec.js:210:12)
at Object.exec (/home/travis/build/dominykas/grunt-checkbranch/node_modules/shelljs/src/common.js:182:23)
at Object.<anonymous> (/home/travis/build/dominykas/grunt-checkbranch/tmp-shelljs/run.js:1:94)
at Module._compile (module.js:410:26)
at Object.Module._extensions..js (module.js:428:10)
at Module.load (module.js:335:32)
at Function.Module._load (module.js:290:12)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment