fix(core): update
This commit is contained in:
parent
9bb0999f0e
commit
ba8c2d06d8
151
package-lock.json
generated
151
package-lock.json
generated
@ -61,9 +61,9 @@
|
||||
}
|
||||
},
|
||||
"@gitzone/tstest": {
|
||||
"version": "1.0.22",
|
||||
"resolved": "https://verdaccio.lossless.one/@gitzone%2ftstest/-/tstest-1.0.22.tgz",
|
||||
"integrity": "sha512-S3Gcyml+Fr4+QYinRcUmedvR8E+MfPik6P7Om4cwI1DyrNvBt0BgCricfxIKrqI8qleY1mtAbJWm8d3BO/ZSww==",
|
||||
"version": "1.0.23",
|
||||
"resolved": "https://registry.npmjs.org/@gitzone/tstest/-/tstest-1.0.23.tgz",
|
||||
"integrity": "sha512-iP+bCTVV+67MvWwM1l4AfQ0NuLP0xgsf2OTeUICq6I1zHm2bbGr7UuNZ2veBkx3fFb4A2Acs49bs5EkukYMi4Q==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@gitzone/tsrun": "^1.2.6",
|
||||
@ -71,7 +71,7 @@
|
||||
"@pushrocks/smartfile": "^7.0.2",
|
||||
"@pushrocks/smartlog": "^2.0.19",
|
||||
"@pushrocks/smartpromise": "^3.0.2",
|
||||
"@pushrocks/smartshell": "^2.0.17",
|
||||
"@pushrocks/smartshell": "^2.0.20",
|
||||
"@types/figures": "^3.0.1",
|
||||
"figures": "^3.0.0"
|
||||
}
|
||||
@ -149,7 +149,7 @@
|
||||
},
|
||||
"@pushrocks/smartdelay": {
|
||||
"version": "2.0.3",
|
||||
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartdelay/-/smartdelay-2.0.3.tgz",
|
||||
"resolved": "https://registry.npmjs.org/@pushrocks/smartdelay/-/smartdelay-2.0.3.tgz",
|
||||
"integrity": "sha512-TXKDDqsc7sBTLl+oiYNaF6IdNk1n70i8ur8QfwcUU6tegTnrEkvMWy9h5Zdty/fq1ioCNpKLvuXoA+fgYVwKGQ==",
|
||||
"requires": {
|
||||
"@pushrocks/smartpromise": "^3.0.2"
|
||||
@ -171,12 +171,13 @@
|
||||
}
|
||||
},
|
||||
"@pushrocks/smartexit": {
|
||||
"version": "1.0.11",
|
||||
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartexit/-/smartexit-1.0.11.tgz",
|
||||
"integrity": "sha512-zQTmmHQFwTC0tta+mcfkA9gVYR0OT9hKtiYGIW5wnOLFc3FxRREfIwuatxI1UwJ+CDCjy9IgNL6WWqZP+2VMeQ==",
|
||||
"version": "1.0.15",
|
||||
"resolved": "https://registry.npmjs.org/@pushrocks/smartexit/-/smartexit-1.0.15.tgz",
|
||||
"integrity": "sha512-pvJBmF13spcDN+O8rSpYlKBOObyfW+omZKQr3hhSMT1VHMEYV8e/njsA19Cg4C2DfLPv+cRFFgPn27zJpleRsQ==",
|
||||
"requires": {
|
||||
"@pushrocks/lik": "^3.0.5",
|
||||
"@pushrocks/smartdelay": "^2.0.3"
|
||||
"@pushrocks/smartdelay": "^2.0.3",
|
||||
"@pushrocks/smartlog-source-ora": "^1.0.7"
|
||||
}
|
||||
},
|
||||
"@pushrocks/smartfile": {
|
||||
@ -208,8 +209,16 @@
|
||||
"@pushrocks/smartlog-interfaces": {
|
||||
"version": "2.0.5",
|
||||
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartlog-interfaces/-/smartlog-interfaces-2.0.5.tgz",
|
||||
"integrity": "sha512-eLNlRpDwy3E+6v/B6fo/NiAo+UxBO3SxKgIIsgUGbWfVpsyUi0PG2xfVCdhJlhL1AsRRvKglfHSOB8qKE+XCLw==",
|
||||
"dev": true
|
||||
"integrity": "sha512-eLNlRpDwy3E+6v/B6fo/NiAo+UxBO3SxKgIIsgUGbWfVpsyUi0PG2xfVCdhJlhL1AsRRvKglfHSOB8qKE+XCLw=="
|
||||
},
|
||||
"@pushrocks/smartlog-source-ora": {
|
||||
"version": "1.0.7",
|
||||
"resolved": "https://registry.npmjs.org/@pushrocks/smartlog-source-ora/-/smartlog-source-ora-1.0.7.tgz",
|
||||
"integrity": "sha512-lgpZ2rBLt9UGIdMb43cB9rxwtbu4RaNmdQnAYfNGxizGPuNtXw3WAzdHyS5tEJFZAbvMOiwNguQ6Bk1i2gaedw==",
|
||||
"requires": {
|
||||
"@pushrocks/smartlog-interfaces": "^2.0.5",
|
||||
"ora": "^3.4.0"
|
||||
}
|
||||
},
|
||||
"@pushrocks/smartparam": {
|
||||
"version": "1.0.4",
|
||||
@ -271,12 +280,12 @@
|
||||
}
|
||||
},
|
||||
"@pushrocks/smartshell": {
|
||||
"version": "2.0.17",
|
||||
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartshell/-/smartshell-2.0.17.tgz",
|
||||
"integrity": "sha512-hPQD0Hk9x0FdhggrtBpDH+mb018oVveNOILaCSiVdOuBXb4UnS2WeNixHiGWWRwppH3anpUJ5iW+3Lo/VFUzOQ==",
|
||||
"version": "2.0.20",
|
||||
"resolved": "https://registry.npmjs.org/@pushrocks/smartshell/-/smartshell-2.0.20.tgz",
|
||||
"integrity": "sha512-wA6crDGvEK7s9jTA5hJPjirTYs/1Wbt5zcAp/0AbB9Qxkzj/+alVueBGvD9NrXYhfn5EFeelwS5/Oy4lLm3A7A==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@pushrocks/smartexit": "^1.0.10",
|
||||
"@pushrocks/smartexit": "^1.0.11",
|
||||
"@pushrocks/smartpromise": "^3.0.2",
|
||||
"@types/which": "^1.3.1",
|
||||
"which": "^1.3.1"
|
||||
@ -418,7 +427,6 @@
|
||||
"version": "3.2.1",
|
||||
"resolved": "https://verdaccio.lossless.one/ansi-styles/-/ansi-styles-3.2.1.tgz",
|
||||
"integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"color-convert": "^1.9.0"
|
||||
}
|
||||
@ -524,7 +532,6 @@
|
||||
"version": "2.4.2",
|
||||
"resolved": "https://verdaccio.lossless.one/chalk/-/chalk-2.4.2.tgz",
|
||||
"integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"ansi-styles": "^3.2.1",
|
||||
"escape-string-regexp": "^1.0.5",
|
||||
@ -537,6 +544,19 @@
|
||||
"integrity": "sha1-V00xLt2Iu13YkS6Sht1sCu1KrII=",
|
||||
"dev": true
|
||||
},
|
||||
"cli-cursor": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-2.1.0.tgz",
|
||||
"integrity": "sha1-s12sN2R5+sw+lHR9QdDQ9SOP/LU=",
|
||||
"requires": {
|
||||
"restore-cursor": "^2.0.0"
|
||||
}
|
||||
},
|
||||
"cli-spinners": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/cli-spinners/-/cli-spinners-2.1.0.tgz",
|
||||
"integrity": "sha512-8B00fJOEh1HPrx4fo5eW16XmE1PcL1tGpGrxy63CXGP9nHdPBN63X75hA1zhvQuhVztJWLqV58Roj2qlNM7cAA=="
|
||||
},
|
||||
"cliui": {
|
||||
"version": "4.1.0",
|
||||
"resolved": "https://verdaccio.lossless.one/cliui/-/cliui-4.1.0.tgz",
|
||||
@ -587,7 +607,6 @@
|
||||
"version": "1.9.3",
|
||||
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz",
|
||||
"integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"color-name": "1.1.3"
|
||||
}
|
||||
@ -595,8 +614,7 @@
|
||||
"color-name": {
|
||||
"version": "1.1.3",
|
||||
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz",
|
||||
"integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=",
|
||||
"dev": true
|
||||
"integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU="
|
||||
},
|
||||
"combined-stream": {
|
||||
"version": "1.0.8",
|
||||
@ -660,6 +678,21 @@
|
||||
"type-detect": "^4.0.0"
|
||||
}
|
||||
},
|
||||
"defaults": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/defaults/-/defaults-1.0.3.tgz",
|
||||
"integrity": "sha1-xlYFHpgX2f8I7YgUd/P+QBnz730=",
|
||||
"requires": {
|
||||
"clone": "^1.0.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"clone": {
|
||||
"version": "1.0.4",
|
||||
"resolved": "https://registry.npmjs.org/clone/-/clone-1.0.4.tgz",
|
||||
"integrity": "sha1-2jCcwmPfFZlMaIypAheco8fNfH4="
|
||||
}
|
||||
}
|
||||
},
|
||||
"delayed-stream": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
|
||||
@ -690,8 +723,7 @@
|
||||
"escape-string-regexp": {
|
||||
"version": "1.0.5",
|
||||
"resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz",
|
||||
"integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=",
|
||||
"dev": true
|
||||
"integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ="
|
||||
},
|
||||
"esprima": {
|
||||
"version": "4.0.1",
|
||||
@ -825,8 +857,7 @@
|
||||
"has-flag": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz",
|
||||
"integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=",
|
||||
"dev": true
|
||||
"integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0="
|
||||
},
|
||||
"inflight": {
|
||||
"version": "1.0.6",
|
||||
@ -948,6 +979,14 @@
|
||||
"path-exists": "^3.0.0"
|
||||
}
|
||||
},
|
||||
"log-symbols": {
|
||||
"version": "2.2.0",
|
||||
"resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-2.2.0.tgz",
|
||||
"integrity": "sha512-VeIAFslyIerEJLXHziedo2basKbMKtTw3vfn5IzG0XTjhAVEJyNHnL2p7vc+wBDSdQuUpNw3M2u6xb9QsAY5Eg==",
|
||||
"requires": {
|
||||
"chalk": "^2.0.1"
|
||||
}
|
||||
},
|
||||
"luxon": {
|
||||
"version": "1.13.2",
|
||||
"resolved": "https://verdaccio.lossless.one/luxon/-/luxon-1.13.2.tgz",
|
||||
@ -1080,6 +1119,49 @@
|
||||
"wrappy": "1"
|
||||
}
|
||||
},
|
||||
"onetime": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/onetime/-/onetime-2.0.1.tgz",
|
||||
"integrity": "sha1-BnQoIw/WdEOyeUsiu6UotoZ5YtQ=",
|
||||
"requires": {
|
||||
"mimic-fn": "^1.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"mimic-fn": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-1.2.0.tgz",
|
||||
"integrity": "sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ=="
|
||||
}
|
||||
}
|
||||
},
|
||||
"ora": {
|
||||
"version": "3.4.0",
|
||||
"resolved": "https://registry.npmjs.org/ora/-/ora-3.4.0.tgz",
|
||||
"integrity": "sha512-eNwHudNbO1folBP3JsZ19v9azXWtQZjICdr3Q0TDPIaeBQ3mXLrh54wM+er0+hSp+dWKf+Z8KM58CYzEyIYxYg==",
|
||||
"requires": {
|
||||
"chalk": "^2.4.2",
|
||||
"cli-cursor": "^2.1.0",
|
||||
"cli-spinners": "^2.0.0",
|
||||
"log-symbols": "^2.2.0",
|
||||
"strip-ansi": "^5.2.0",
|
||||
"wcwidth": "^1.0.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"ansi-regex": {
|
||||
"version": "4.1.0",
|
||||
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz",
|
||||
"integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg=="
|
||||
},
|
||||
"strip-ansi": {
|
||||
"version": "5.2.0",
|
||||
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz",
|
||||
"integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==",
|
||||
"requires": {
|
||||
"ansi-regex": "^4.1.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"os-locale": {
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://verdaccio.lossless.one/os-locale/-/os-locale-3.1.0.tgz",
|
||||
@ -1239,6 +1321,15 @@
|
||||
"path-parse": "^1.0.6"
|
||||
}
|
||||
},
|
||||
"restore-cursor": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-2.0.0.tgz",
|
||||
"integrity": "sha1-n37ih/gv0ybU/RYpI9YhKe7g368=",
|
||||
"requires": {
|
||||
"onetime": "^2.0.0",
|
||||
"signal-exit": "^3.0.2"
|
||||
}
|
||||
},
|
||||
"rxjs": {
|
||||
"version": "6.5.2",
|
||||
"resolved": "https://verdaccio.lossless.one/rxjs/-/rxjs-6.5.2.tgz",
|
||||
@ -1283,8 +1374,7 @@
|
||||
"signal-exit": {
|
||||
"version": "3.0.2",
|
||||
"resolved": "https://verdaccio.lossless.one/signal-exit/-/signal-exit-3.0.2.tgz",
|
||||
"integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=",
|
||||
"dev": true
|
||||
"integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0="
|
||||
},
|
||||
"smartchai": {
|
||||
"version": "2.0.1",
|
||||
@ -1388,7 +1478,6 @@
|
||||
"version": "5.5.0",
|
||||
"resolved": "https://verdaccio.lossless.one/supports-color/-/supports-color-5.5.0.tgz",
|
||||
"integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"has-flag": "^3.0.0"
|
||||
}
|
||||
@ -1503,6 +1592,14 @@
|
||||
"vinyl": "^2.0.1"
|
||||
}
|
||||
},
|
||||
"wcwidth": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/wcwidth/-/wcwidth-1.0.1.tgz",
|
||||
"integrity": "sha1-8LDc+RW8X/FSivrbLA4XtTLaL+g=",
|
||||
"requires": {
|
||||
"defaults": "^1.0.3"
|
||||
}
|
||||
},
|
||||
"which": {
|
||||
"version": "1.3.1",
|
||||
"resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz",
|
||||
|
@ -26,14 +26,15 @@
|
||||
"devDependencies": {
|
||||
"@gitzone/tsbuild": "^2.1.11",
|
||||
"@gitzone/tsrun": "^1.2.6",
|
||||
"@gitzone/tstest": "^1.0.22",
|
||||
"@gitzone/tstest": "^1.0.23",
|
||||
"@pushrocks/tapbundle": "^3.0.9",
|
||||
"@types/node": "^12.0.2",
|
||||
"tslint": "^5.16.0",
|
||||
"tslint-config-prettier": "^1.18.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@pushrocks/smartexit": "^1.0.11",
|
||||
"@pushrocks/smartdelay": "^2.0.3",
|
||||
"@pushrocks/smartexit": "^1.0.15",
|
||||
"@pushrocks/smartpromise": "^3.0.2",
|
||||
"@types/which": "^1.3.1",
|
||||
"which": "^1.3.1"
|
||||
|
@ -45,7 +45,11 @@ tap.test('smartshell should run async', async () => {
|
||||
});
|
||||
|
||||
tap.test('should be able to find git', async () => {
|
||||
testSmartshell.exec('git --version');
|
||||
await testSmartshell.exec('git --version');
|
||||
});
|
||||
|
||||
tap.test('should spawn an interactive cli', async () => {
|
||||
await testSmartshell.execInteractive('echo "hi"');
|
||||
});
|
||||
|
||||
tap.start({
|
||||
|
@ -5,13 +5,13 @@ import * as plugins from './smartshell.plugins';
|
||||
* making sure the process doesn't run out of memory
|
||||
*/
|
||||
export class ShellLog {
|
||||
logStore = Buffer.from('');
|
||||
public logStore = Buffer.from('');
|
||||
|
||||
/**
|
||||
* log data to console
|
||||
* @param dataArg
|
||||
*/
|
||||
logToConsole(dataArg: string | Buffer): void {
|
||||
public writeToConsole(dataArg: string | Buffer): void {
|
||||
// make sure we have the data as string
|
||||
process.stdout.write(dataArg);
|
||||
}
|
||||
@ -20,7 +20,7 @@ export class ShellLog {
|
||||
* add data to Buffer for later consumption
|
||||
* @param dataArg
|
||||
*/
|
||||
addToBuffer(dataArg: string | Buffer): void {
|
||||
public addToBuffer(dataArg: string | Buffer): void {
|
||||
// make sure we have the data as Buffer
|
||||
const dataBuffer: Buffer = (() => {
|
||||
if (!Buffer.isBuffer(dataArg)) {
|
||||
@ -31,8 +31,8 @@ export class ShellLog {
|
||||
this.logStore = Buffer.concat([this.logStore, dataBuffer]);
|
||||
}
|
||||
|
||||
logAndAdd(dataArg: string | Buffer): void {
|
||||
this.logToConsole(dataArg);
|
||||
public logAndAdd(dataArg: string | Buffer): void {
|
||||
this.writeToConsole(dataArg);
|
||||
this.addToBuffer(dataArg);
|
||||
}
|
||||
}
|
||||
|
@ -60,13 +60,13 @@ export class Smartshell {
|
||||
|
||||
execChildProcess.stdout.on('data', data => {
|
||||
if (!silentArg) {
|
||||
spawnlogInstance.logToConsole(data);
|
||||
spawnlogInstance.writeToConsole(data);
|
||||
}
|
||||
spawnlogInstance.addToBuffer(data);
|
||||
});
|
||||
execChildProcess.stderr.on('data', data => {
|
||||
if (!silentArg) {
|
||||
spawnlogInstance.logToConsole(data);
|
||||
spawnlogInstance.writeToConsole(data);
|
||||
}
|
||||
spawnlogInstance.addToBuffer(data);
|
||||
});
|
||||
@ -103,7 +103,7 @@ export class Smartshell {
|
||||
return result;
|
||||
}
|
||||
|
||||
async exec(commandStringArg: string): Promise<IExecResult> {
|
||||
public async exec(commandStringArg: string): Promise<IExecResult> {
|
||||
return (await this._exec(commandStringArg, false)) as IExecResult;
|
||||
}
|
||||
|
||||
@ -111,28 +111,28 @@ export class Smartshell {
|
||||
* executes a given command async and silent
|
||||
* @param commandStringArg
|
||||
*/
|
||||
async execSilent(commandStringArg: string): Promise<IExecResult> {
|
||||
public async execSilent(commandStringArg: string): Promise<IExecResult> {
|
||||
return (await this._exec(commandStringArg, true)) as IExecResult;
|
||||
}
|
||||
|
||||
/**
|
||||
* executes a command async and strict, meaning it rejects the promise if something happens
|
||||
*/
|
||||
async execStrict(commandStringArg: string): Promise<IExecResult> {
|
||||
public async execStrict(commandStringArg: string): Promise<IExecResult> {
|
||||
return (await this._exec(commandStringArg, true, true)) as IExecResult;
|
||||
}
|
||||
|
||||
/**
|
||||
* executes a command and allows you to stream output
|
||||
*/
|
||||
async execStreaming(
|
||||
public async execStreaming(
|
||||
commandStringArg: string,
|
||||
silentArg: boolean = false
|
||||
): Promise<IExecResultStreaming> {
|
||||
return (await this._exec(commandStringArg, silentArg, false, true)) as IExecResultStreaming;
|
||||
}
|
||||
|
||||
async execStreamingSilent(commandStringArg: string) {
|
||||
public async execStreamingSilent(commandStringArg: string) {
|
||||
return (await this.execStreaming(commandStringArg, true)) as IExecResultStreaming;
|
||||
}
|
||||
|
||||
@ -141,7 +141,11 @@ export class Smartshell {
|
||||
* @param commandStringArg
|
||||
* @param regexArg
|
||||
*/
|
||||
async execAndWaitForLine(commandStringArg: string, regexArg: RegExp, silentArg: boolean = false) {
|
||||
public async execAndWaitForLine(
|
||||
commandStringArg: string,
|
||||
regexArg: RegExp,
|
||||
silentArg: boolean = false
|
||||
) {
|
||||
let done = plugins.smartpromise.defer();
|
||||
let execStreamingResult = await this.execStreaming(commandStringArg, silentArg);
|
||||
execStreamingResult.childProcess.stdout.on('data', (stdOutChunk: string) => {
|
||||
@ -152,7 +156,27 @@ export class Smartshell {
|
||||
return done.promise;
|
||||
}
|
||||
|
||||
async execAndWaitForLineSilent(commandStringArg: string, regexArg: RegExp) {
|
||||
public async execAndWaitForLineSilent(commandStringArg: string, regexArg: RegExp) {
|
||||
this.execAndWaitForLine(commandStringArg, regexArg, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* execs an command and then enters interactive CLI
|
||||
* @param commandStringArg
|
||||
* @param regexArg
|
||||
*/
|
||||
public async execInteractive(commandStringArg: string) {
|
||||
const done = plugins.smartpromise.defer();
|
||||
const shell = cp.spawn('sh', [], { stdio: 'pipe' });
|
||||
this.smartexit.addProcess(shell);
|
||||
const shellLog = new ShellLog();
|
||||
process.stdin.pipe(shell.stdin);
|
||||
shell.stdout.pipe(process.stdout);
|
||||
shell.on('close', code => {
|
||||
console.log(`interactive shell terminated with code ${code}`);
|
||||
done.resolve();
|
||||
});
|
||||
shell.stdin.write(commandStringArg + '\n');
|
||||
await done.promise;
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
import * as smartdelay from '@pushrocks/smartdelay';
|
||||
import * as smartexit from '@pushrocks/smartexit';
|
||||
import * as smartpromise from '@pushrocks/smartpromise';
|
||||
import * as which from 'which';
|
||||
|
||||
export { smartexit, smartpromise, which };
|
||||
export { smartdelay, smartexit, smartpromise, which };
|
||||
|
Loading…
Reference in New Issue
Block a user