Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MWS: Async rewrite #8888

Open
wants to merge 15 commits into
base: multi-wiki-support
Choose a base branch
from
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
tmp/
output/
node_modules/
store/
/editions/*/store
/test-results/
/playwright-report/
/playwright/.cache/
Expand Down
31 changes: 22 additions & 9 deletions boot/boot.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 15 additions & 9 deletions core/modules/commander.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,25 +109,31 @@ Commander.prototype.executeNextCommand = function() {
}
}
if(command.info.synchronous) {
// Synchronous command
// Synchronous command (or returns a promise)
c = new command.Command(params,this);
err = c.execute();
if(err) {
if(err instanceof Promise){
err.catch(function(e){return e;}).then(function(err) {
if(err) self.callback(err);
else self.executeNextCommand();
});
} else if(err) {
this.callback(err);
} else {
this.executeNextCommand();
}
} else {
// Asynchronous command
// Asynchronous command requires a callback (but we still catch returned errors either way)
c = new command.Command(params,this,function(err) {
if(err) {
self.callback(err);
} else {
self.executeNextCommand();
}
if(err) self.callback(err);
else self.executeNextCommand();
});
err = c.execute();
if(err) {
if(err instanceof Promise){
err.catch(function(e){return e;}).then(function(err) {
if(err) self.callback(err);
});
} else if(err) {
this.callback(err);
}
}
Expand Down
Loading