mirror of
https://github.com/atom/atom.git
synced 2026-01-24 14:28:14 -05:00
Invoke callback even when command fails
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
_ = require 'underscore'
|
||||
BufferedProcess = require 'buffered-process'
|
||||
$ = require 'jquery'
|
||||
|
||||
module.exports =
|
||||
class LoadPathsTask
|
||||
@@ -19,18 +18,12 @@ class LoadPathsTask
|
||||
args.unshift('--follow')
|
||||
|
||||
paths = []
|
||||
deferred = $.Deferred()
|
||||
exit = (code) =>
|
||||
if code is -1
|
||||
deferred.reject({command, code})
|
||||
else
|
||||
@callback(paths)
|
||||
deferred.resolve()
|
||||
exit = =>
|
||||
@callback(paths)
|
||||
stdout = (data) ->
|
||||
paths.push(_.compact(data.split('\n'))...)
|
||||
|
||||
@process = new BufferedProcess({command, args, stdout, exit})
|
||||
deferred
|
||||
|
||||
abort: ->
|
||||
if @process?
|
||||
|
||||
Reference in New Issue
Block a user