Return a promise on commands.dispatch


It would be nice to have a standard way to tell when a dispatched command finished or failed.

The atom.commands.dispatch command could return a promise or it could return whatever is returned by the command function

atom.commands.add("atom-workspace", "my-package:test-promise",  function() {
  return new Promise(function (resolve, reject) {
    setTimeout(_ => resolve("test"), 1000);

atom.commands.dispatch(document.querySelector("atom-workspace"), "my-package:test-promise").then(function(result) {
  // do something


I created a pull request for this: