function copySync (cache, integrity, dest, opts) { opts = ReadOpts(opts) return withContentSriSync(cache, integrity, (cpath, sri) => { return fs.copyFileSync(cpath, dest) }) }
test('addon works with renamed host executable', function (t) { // No `fs.copyFileSync` before node8. if (process.version.substr(1).split('.')[0] < 8) { t.skip('skipping test for old node version') t.end() return } t.plan(3) var notNodePath = path.join(os.tmpdir(), 'notnode' + path.extname(process.execPath)) fs.copyFileSync(process.execPath, notNodePath) var cmd = [nodeGyp, 'rebuild', '-C', addonPath, '--loglevel=verbose'] var proc = execFile(process.execPath, cmd, function (err, stdout, stderr) { var logLines = stderr.toString().trim().split(/\r?\n/) var lastLine = logLines[logLines.length - 1] t.strictEqual(err, null) t.strictEqual(lastLine, 'gyp info ok', 'should end in ok') t.strictEqual(runHello(notNodePath).trim(), 'world') fs.unlinkSync(notNodePath) }) proc.stdout.setEncoding('utf-8') proc.stderr.setEncoding('utf-8') })