bcoe / sandcastle

A simple and powerful sandbox for running untrusted JavaScript.
MIT License
220 stars 48 forks source link

on{TaskName}Task handler will not fire #73

Open sigmasoldi3r opened 6 years ago

sigmasoldi3r commented 6 years ago

When running in sync mode, it runs smooth, ie:

In the script part

exports.main = () => {
  runTask('sampleTask');
};

exports.onSampleTaskTask = () => {
  // Code will reach this without problems
};

At the host side

script.on('task', (err, task, options, method, resolve) => resolve());

But when running async operations this will no longer happen, the on{TaskName}Task handler will not fire, if the host side is like:

script.on('task', (err, task, options, method, resolve) => {
   aTrueAsyncPromise.then((result) => resolve(result));
});

Is there any flag that should be turned on? Or something that I am missing.

PD: I'm not setting timeout because the script depends on user's input, so better to not time out.

bcoe commented 6 years ago

@sigmasoldi3r 👋unfortunately haven't touched this project in a few years (I should update the README with a deprecated notice).

Happy to help land any patches if you manage to debug this issue, but not doing much active development on this project currently.