fix(terminal-run) resolve before close

This commit is contained in:
coderaiser 2019-05-27 12:35:42 +03:00
parent b374437fb6
commit c212acd90b
2 changed files with 21 additions and 18 deletions

View file

@ -54,7 +54,7 @@ module.exports = function loadModule(params) {
if (e)
return console.error(e);
a.show(...args);
await a.show(...args);
};
};

View file

@ -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();
},
});
}