TooTallNate / node-applescript

A Node.js module to easily execute arbitrary AppleScript code on Mac OS X.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

execString()'s callback can not be called when run in child_process of node?

chuanhuizhang opened this issue · comments

I run execString("some applescript", function(){"printout"});
But the callback function doesn't work while the applescript has been execute!
Can someone please give me a help?

Can you give me some complete code to repro the issue?

Might be able to shed some light - a year on. Using a simple process.nextTick() loop causes a similar issue.

var loop = function(){ //Exec here process.nextTick(loop); }; process.nextTick(loop);

@clarkieryan Do you mean something like the following?

process.nextTick(() => {
  applescript.execString('tell application "iTunes" to get name of selection', (err, result) => {
    console.log(result)
  })
})

This works fine for me in Node.js v10 (and even Node.js v4).

Anyway, since another two years have passed, I’m going to close this. If anyone can still reproduce this issue, let me know and I’ll reopen.