diff --git a/client/load-module.js b/client/load-module.js index 9c203e87..17afdef7 100644 --- a/client/load-module.js +++ b/client/load-module.js @@ -54,7 +54,7 @@ module.exports = function loadModule(params) { if (e) return console.error(e); - a.show(...args); + await a.show(...args); }; }; diff --git a/client/modules/terminal-run.js b/client/modules/terminal-run.js index 02ce4f28..01cadf38 100644 --- a/client/modules/terminal-run.js +++ b/client/modules/terminal-run.js @@ -53,7 +53,26 @@ module.exports.init = async () => { await loadAll(); }; -module.exports.show = show; +module.exports.show = promisify((options = {}, fn) => { + if (!Loaded) + return; + + if (!config('terminal')) + return; + + create(options); + + CloudCmd.View.show(Terminal.element, { + afterShow: () => { + Terminal.focus(); + }, + afterClose: (/* exec.series args */) => { + fn(); + }, + }); +}); + + module.exports.hide = hide; function hide () { @@ -128,19 +147,3 @@ function authCheck(spawn) { }); } -async function show(options = {}) { - if (!Loaded) - return; - - if (!config('terminal')) - return; - - await create(options); - - CloudCmd.View.show(Terminal.element, { - afterShow: () => { - Terminal.focus(); - }, - }); -} -