feature(terminal-run) add ability to resolve exit code

This commit is contained in:
coderaiser 2019-05-27 20:02:43 +03:00
parent a360301759
commit 3a16715e03
2 changed files with 8 additions and 4 deletions

View file

@ -4,6 +4,7 @@
const {promisify} = require('es6-promisify');
const tryToCatch = require('try-to-catch/legacy');
const fullstore = require('fullstore/legacy');
require('../../css/terminal.css');
@ -26,6 +27,8 @@ let Loaded;
let Terminal;
let Socket;
const exitCodeStore = fullstore();
const loadAll = async () => {
const {prefix} = CloudCmd;
@ -67,12 +70,11 @@ module.exports.show = promisify((options = {}, fn) => {
Terminal.focus();
},
afterClose: (/* exec.series args */) => {
fn();
fn(null, exitCodeStore());
},
});
});
module.exports.hide = hide;
function hide () {
@ -128,7 +130,9 @@ function create(createOptions) {
}
});
Socket.on('exit', () => {
Socket.on('exit', (code) => {
exitCodeStore(code);
if (autoClose)
return hide();

View file

@ -163,7 +163,7 @@
"extract-text-webpack-plugin": "^4.0.0-alpha.0",
"fast-async": "^7.0.6",
"file-loader": "^3.0.1",
"gritty": "^4.0.0",
"gritty": "^4.6.0",
"gunzip-maybe": "^1.3.1",
"html-looks-like": "^1.0.2",
"html-webpack-plugin": "^3.0.7",