Commit 6dc6c632 by Adeel

Code: Resolves symbolic link.

On Windows, process.execPath does not
get resolved symlink path. This commit
fixes the issue.

Related Issue: iojs/io.js#851.
PR URL: #668.
parent b0435cbd
var semver = require('semver'),
runtimeVersion = semver.parse(process.version);
runtimeVersion = semver.parse(process.version),
fs = require('fs');
/**
* Get Runtime Name
* Get Runtime Info
*
* @api private
*/
function getRuntimeName() {
var runtime = process.execPath
function getRuntimeInfo() {
var execPath = fs.realpathSync(process.execPath); // resolve symbolic link
var runtime = execPath
.split(/[\\/]+/).pop()
.split('.').shift();
return runtime === 'nodejs' ? 'node' : runtime;
runtime = runtime === 'nodejs' ? 'node' : runtime;
return {
name: runtime,
execPath: execPath
};
}
/**
......@@ -24,10 +32,10 @@ function getRuntimeName() {
function getBinaryIdentifiableName() {
return [process.platform, '-',
process.arch, '-',
getRuntimeName(), '-',
process.runtime.name, '-',
runtimeVersion.major, '.',
runtimeVersion.minor].join('');
}
process.runtime = getRuntimeName();
process.runtime = getRuntimeInfo();
process.sassBinaryName = getBinaryIdentifiableName();
......@@ -50,7 +50,11 @@ function afterBuild(options) {
*/
function build(options) {
var proc = spawn(process.execPath, ['node_modules/pangyp/bin/node-gyp', 'rebuild'].concat(options.args), {
var arguments = ['node_modules/pangyp/bin/node-gyp', 'rebuild'].concat(options.args);
console.log(['Building:', process.runtime.execPath].concat(arguments).join(' '));
var proc = spawn(process.runtime.execPath, arguments, {
stdio: [0, 1, 2]
});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment