mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 02:35:49 +00:00
fix(terminal) config: terminal and terminalPath checked before set
This commit is contained in:
parent
a260a921ba
commit
10307291a3
3 changed files with 21 additions and 10 deletions
|
|
@ -6,9 +6,11 @@ const config = require('./config');
|
|||
const noop = () => {};
|
||||
noop.listen = noop;
|
||||
|
||||
module.exports = getTerminal(config('terminal'));
|
||||
module.exports = (arg) => {
|
||||
return getTerminal(config('terminal'), arg);
|
||||
};
|
||||
|
||||
function getTerminal(term) {
|
||||
function getTerminal(term, arg) {
|
||||
if (!term)
|
||||
return noop;
|
||||
|
||||
|
|
@ -18,9 +20,12 @@ function getTerminal(term) {
|
|||
result = require(config('terminalPath'));
|
||||
});
|
||||
|
||||
if (!e)
|
||||
if (!e && !arg)
|
||||
return result;
|
||||
|
||||
if (!e)
|
||||
return result(arg);
|
||||
|
||||
config('terminal', false);
|
||||
console.log(`cloudcmd --terminal: ${e.message}`);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue