mirror of
https://github.com/atom/atom.git
synced 2026-01-23 13:58:08 -05:00
Capture stderr
This commit is contained in:
@@ -18,7 +18,9 @@ spawn = (command, args, callback) ->
|
||||
spawnedProcess = ChildProcess.spawn(command, args)
|
||||
|
||||
stdout = ''
|
||||
stderr = ''
|
||||
spawnedProcess.stdout.on 'data', (data) -> stdout += data
|
||||
spawnedProcess.stderr.on 'data', (data) -> stderr += data
|
||||
|
||||
error = null
|
||||
spawnedProcess.on 'error', (processError) -> error ?= processError
|
||||
@@ -26,7 +28,8 @@ spawn = (command, args, callback) ->
|
||||
error ?= new Error("Command failed: #{signal ? code}") if code isnt 0
|
||||
error?.code ?= code
|
||||
error?.stdout ?= stdout
|
||||
callback(error, stdout)
|
||||
error?.stderr ?= stderr
|
||||
callback(error, stdout, stderr)
|
||||
|
||||
# Spawn reg.exe and callback when it completes
|
||||
spawnReg = (args, callback) ->
|
||||
@@ -91,9 +94,8 @@ updatePath = (callback) ->
|
||||
callback()
|
||||
|
||||
getPath = (callback) ->
|
||||
spawnReg ['query', environmentKeyPath, '/v', 'Path'], (error, stdout) ->
|
||||
console.log error
|
||||
console.log stdout
|
||||
spawnReg ['query', environmentKeyPath, '/v', 'Path'], (error, stdout, stderr) ->
|
||||
console.log stderr
|
||||
return callback(error) if error?
|
||||
|
||||
lines = stdout.split(/[\r\n]+/).filter (line) -> line
|
||||
|
||||
Reference in New Issue
Block a user