Skip to content

Instantly share code, notes, and snippets.

@jmervine
Created January 18, 2016 16:54
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 jmervine/87b20bd99dba7a09cde9 to your computer and use it in GitHub Desktop.
Save jmervine/87b20bd99dba7a09cde9 to your computer and use it in GitHub Desktop.
var assert = require('assert');
var exec = require('child_process').execFileSync;
// execFileSync throw an error if it returns a non-zero exit status
assert(exec('./index.js'));
/*
For the above to work index.js needs:
1. to be executable (i.e. 0755)
2. it's first line to contain `#!/usr/bin/env node`
Otherwise, you would want something like:
assert(exec('/usr/bin/node', ['./index.js']));
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment