fb-watchman
Advanced tools
Comparing version 1.4.0 to 1.5.0
44
index.js
@@ -147,6 +147,33 @@ /* Copyright 2014-present Facebook, Inc. | ||
// we can discover the problem. | ||
proc = childProcess.spawn(this.watchmanBinaryPath, args, { | ||
stdio: ['ignore', 'pipe', 'pipe'] | ||
}); | ||
var proc = null; | ||
var spawnFailed = false; | ||
function spawnError(error) { | ||
if (spawnFailed) { | ||
// For ENOENT, proc 'close' will also trigger with a negative code, | ||
// let's suppress that second error. | ||
return; | ||
} | ||
spawnFailed = true; | ||
if (error.errno === 'EACCES') { | ||
error.message = 'The Watchman CLI is installed but cannot ' + | ||
'be spawned because of a permission problem'; | ||
} else if (error.errno === 'ENOENT') { | ||
error.message = 'Watchman was not found in PATH. See ' + | ||
'https://facebook.github.io/watchman/docs/install.html ' + | ||
'for installation instructions'; | ||
} | ||
console.log('Watchman: ', error.message); | ||
self.emit('error', error); | ||
} | ||
try { | ||
proc = childProcess.spawn(this.watchmanBinaryPath, args, { | ||
stdio: ['ignore', 'pipe', 'pipe'] | ||
}); | ||
} catch (error) { | ||
spawnError(error); | ||
return; | ||
} | ||
var stdout = []; | ||
@@ -162,10 +189,11 @@ var stderr = []; | ||
}); | ||
proc.on('error', function(error) { | ||
spawnError(error); | ||
}); | ||
proc.on('close', function (code) { | ||
if (code !== 0) { | ||
var why = this.watchmanBinaryPath + args.join(' ') + | ||
' returned with exit code ' + code + ' ' + | ||
stderr.join(''); | ||
console.log(why); | ||
self.emit('error', why); | ||
spawnError(new Error( | ||
self.watchmanBinaryPath + args.join(' ') + | ||
' returned with exit code ' + code + ' ' + stderr.join(''))); | ||
return; | ||
@@ -172,0 +200,0 @@ } |
{ | ||
"name": "fb-watchman", | ||
"version": "1.4.0", | ||
"version": "1.5.0", | ||
"description": "Bindings for the Watchman file watching service", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
26132
807