タスクがいつ完了したかを知るためにコールバックを提供するにはどうすればよいですか? NSRunLoop などを設定する必要がありますか?
ObjC.import('Cocoa');
exec("/usr/bin/say",["hello"])
function done(notification) {
$.NSLog('Application done');
$.NSLog(notification);
}
function exec(cmd,args){
var task = $.NSTask.alloc.init
task.launchPath=cmd
task.arguments=args
task.terminationHandler = $(done) // does not work!
task.launch
$.NSLog("running: "+task.running)
return task
}
PS 言語は Automaton の JavaScript で、Yosemite OS X 10.10 の新しい OSASCRIPT 言語です。