-
-
Save isaacs/36512d696f11288fc106e67644f0b8f5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env node | |
if (process.env.xyz) { | |
console.log('in t.js, xyz=%j', process.env.xyz) | |
console.log('gc is a', typeof gc) | |
console.log('%s %j', process.execPath, process.execArgv.concat(process.argv)) | |
console.log('node@%s', process.version) | |
console.log('about to run the main file\u001b[32m') | |
require('./index.js').runMain() | |
console.log('\u001b[31mran wrapped main') | |
return | |
} | |
var wrap = require('./index.js') | |
var unwrap = wrap(['--expose_gc', __filename, ' a $ b '], { xyz: 'ABC' }) | |
console.log('about to run child process') | |
console.log('gc is a', typeof gc) | |
var cp = require('child_process') | |
var node = process.env.NODE || process.execPath | |
console.error('node=%s', node) | |
var child = cp.exec(node+ ' $(which tap ) -v', { env: { foo: 'asdf', PATH:process.env.PATH } }, function (er, out, err) { | |
console.error('returned') | |
console.error('error = ', er) | |
console.error('outlen=', out.length) | |
console.error('\u001b[31m' + out + '\u001b[m') | |
console.error('errlen=', err.length) | |
process.stderr.write(err) | |
}) |
Note that it's running /Users/isaacs/.nave/installed/6.9.1/bin/node
, not /usr/local/bin/node
, which was the one that was being replaced.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Running this in a NAVE shell, where
process.execPath
will be something other than the suppliedNODE
environ: