From 9677dcb6bd6d7ffec469323a3e38071d9125e990 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Fri, 19 Oct 2018 23:33:13 +0300 Subject: [PATCH] feature(package) console-io v9.0.0 --- client/modules/konsole.js | 24 +++++++++++------------- package.json | 2 +- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/client/modules/konsole.js b/client/modules/konsole.js index 67ea2e17..c1df60d2 100644 --- a/client/modules/konsole.js +++ b/client/modules/konsole.js @@ -81,7 +81,7 @@ const getDirPath = () => { return Info.dirPath; }; -const create = promisify((callback) => { +const create = async () => { const options = { cwd: getDirPath(), env: getEnv(), @@ -93,14 +93,12 @@ const create = promisify((callback) => { className: 'console', }); - konsole = Console(Element, options, (spawn) => { - spawn.on('connect', exec.with(authCheck, spawn)); - spawn.on('path', config.if('syncConsolePath', onPath)); - - CloudCmd.on('active-dir', config.if('syncConsolePath', cd(spawn.handler))); - - exec(callback); - }); + konsole = await Console(Element, options); + + konsole.on('connect', exec.with(authCheck, konsole)); + konsole.on('path', config.if('syncConsolePath', onPath)); + + CloudCmd.on('active-dir', config.if('syncConsolePath', cd(konsole.handler))); konsole.addShortCuts({ 'P': () => { @@ -110,12 +108,12 @@ const create = promisify((callback) => { konsole.setPromptText(command + path); } }); -}); +}; -function authCheck(spawn) { - spawn.emit('auth', config('username'), config('password')); +function authCheck(konsole) { + konsole.emit('auth', config('username'), config('password')); - spawn.on('reject', () => { + konsole.on('reject', () => { Dialog.alert(TITLE, 'Wrong credentials!'); }); } diff --git a/package.json b/package.json index 02d8f95b..7e0944c4 100644 --- a/package.json +++ b/package.json @@ -115,7 +115,7 @@ "@cloudcmd/read-files-sync": "^2.0.0", "apart": "^2.0.0", "chalk": "^2.0.1", - "console-io": "^8.0.0", + "console-io": "^9.0.0", "copymitter": "^4.0.2", "criton": "^1.0.0", "currify": "^3.0.0",