Merge pull request #185 from lloeki/eh-1.19

Support Promise response in trySave
This commit is contained in:
Edvin Hultberg 2017-07-29 17:39:11 +02:00 committed by GitHub
commit 5301f4a5d4

View file

@ -17,8 +17,13 @@ trySave = (func) ->
deferred = defer() deferred = defer()
try try
func() response = func()
deferred.resolve()
if response instanceof Promise
response.then ->
deferred.resolve()
else
deferred.resolve()
catch error catch error
if error.message.endsWith('is a directory') if error.message.endsWith('is a directory')
atom.notifications.addWarning("Unable to save file: #{error.message}") atom.notifications.addWarning("Unable to save file: #{error.message}")
@ -252,7 +257,7 @@ class Ex
@write(args) @write(args)
wq: (args) => wq: (args) =>
@write(args).then => @quit() @write(args).then(=> @quit())
wa: => wa: =>
@wall() @wall()