mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-09-20 15:37:46 +03:00
Only show stderr if the process fails
This commit is contained in:
parent
53f5e9fbc6
commit
6bb3a69410
@ -32,9 +32,18 @@ module.exports = (grunt) ->
|
||||
grunt.file.delete(args..., force: true) if grunt.file.exists(args...)
|
||||
|
||||
spawn: (options, callback) ->
|
||||
grunt.util.spawn options, (error, results, code) ->
|
||||
grunt.log.errorlns results.stderr if results.stderr
|
||||
callback(error, results, code)
|
||||
childProcess = require 'child_process'
|
||||
stdout = []
|
||||
stderr = []
|
||||
error = null
|
||||
proc = childProcess.spawn(options.cmd, options.args, options.opts)
|
||||
proc.stdout.on 'data', (data) -> stdout.push(data.toString())
|
||||
proc.stderr.on 'data', (data) -> stderr.push(data.toString())
|
||||
proc.on 'exit', (exitCode, signal) ->
|
||||
error = new Error(signal) if exitCode != 0
|
||||
results = {stderr: stderr.join(''), stdout: stdout.join(''), code: exitCode}
|
||||
grunt.log.error results.stderr if exitCode != 0
|
||||
callback(error, results, exitCode)
|
||||
|
||||
isAtomPackage: (packagePath) ->
|
||||
try
|
||||
|
Loading…
Reference in New Issue
Block a user