fix(core): update

This commit is contained in:
Philipp Kunz 2023-06-22 13:54:39 +02:00
parent ec29db26ef
commit c5937da870
5 changed files with 34 additions and 43 deletions

View File

@ -29,7 +29,7 @@
"@gitzone/tsbuild": "^2.1.66",
"@gitzone/tsrun": "^1.2.42",
"@gitzone/tstest": "^1.0.74",
"@pushrocks/tapbundle": "^5.0.4",
"@pushrocks/tapbundle": "^5.0.8",
"@types/node": "^20.3.1"
},
"dependencies": {

View File

@ -35,8 +35,8 @@ devDependencies:
specifier: ^1.0.74
version: 1.0.74(@types/node@20.3.1)
'@pushrocks/tapbundle':
specifier: ^5.0.4
version: 5.0.4
specifier: ^5.0.8
version: 5.0.8
'@types/node':
specifier: ^20.3.1
version: 20.3.1
@ -388,7 +388,7 @@ packages:
'@pushrocks/smartlog': 3.0.2
'@pushrocks/smartpromise': 3.1.10
'@pushrocks/smartshell': 2.0.30
'@pushrocks/tapbundle': 5.0.4
'@pushrocks/tapbundle': 5.0.8
figures: 5.0.0
transitivePeerDependencies:
- '@swc/core'
@ -632,11 +632,11 @@ packages:
'@pushrocks/lik': 4.0.22
'@pushrocks/smartdelay': 2.0.13
/@pushrocks/smartexpect@1.0.14:
resolution: {integrity: sha512-YIvRFNQbNZ87EDK45evj4XpX6KaBpuPnIKEafZGSpncNTm30VcMATRgcxqk/x9f8hm1p1i4QMwmSr4MuF0cCWQ==}
/@pushrocks/smartexpect@1.0.15:
resolution: {integrity: sha512-ABhsgmTqE1cfL6m0qpicZf6FdfuUip3oJR8CDr9wZwkBODKpahv7lHqeN0EjdvaJuHyqqcd3m1WaHmLPEyZ63A==}
dependencies:
'@pushrocks/smartdelay': 2.0.13
'@pushrocks/smartpromise': 3.1.10
'@pushrocks/smartdelay': 3.0.1
'@pushrocks/smartpromise': 4.0.2
fast-deep-equal: 3.1.3
dev: true
@ -1013,15 +1013,16 @@ packages:
through2: 4.0.2
dev: true
/@pushrocks/tapbundle@5.0.4:
resolution: {integrity: sha512-sEUepgMsH+abdtBGN0FSTHhJzG/IpZ1XVDm8YF6ma21A6Z8DUXTbEbpGWC/Goi2HCSkgHNxmgMSshT1zAO/xXA==}
/@pushrocks/tapbundle@5.0.8:
resolution: {integrity: sha512-w6oyVA1VYht5/OnUrWrvdDqBpb3H5ao3LATKauTG9wSyOng65/8ttAbhHqg5Jo39Hlib9QYbLH3QQyLfukfxCw==}
dependencies:
'@open-wc/testing': 3.2.0
'@pushrocks/smartdelay': 2.0.13
'@open-wc/testing-helpers': 2.3.0
'@pushrocks/smartdelay': 3.0.1
'@pushrocks/smartenv': 5.0.5
'@pushrocks/smartexpect': 1.0.14
'@pushrocks/smartpromise': 3.1.10
'@pushrocks/smarttime': 3.0.50
'@pushrocks/smartexpect': 1.0.15
'@pushrocks/smartpromise': 4.0.2
'@pushrocks/smarttime': 4.0.1
transitivePeerDependencies:
- bufferutil
- supports-color

View File

@ -15,12 +15,12 @@ tap.test('smartshell should create a Smartshell instance', async () => {
tap.test('smartshell should run async', async () => {
let execResult = await testSmartshell.exec('npm -v');
// expect(execResult.stdout).toMatch(/[0-9\.]*/);
expect(execResult.stdout).toMatch(/[0-9\.]*/);
});
tap.test('smartshell should run async and silent', async () => {
let execResult = await testSmartshell.execSilent('npm -v');
// expect(execResult.stdout).toMatch(/[0-9\.]*/);
expect(execResult.stdout).toMatch(/[0-9\.]*/);
});
tap.test('smartshell should stream a shell execution', async () => {
@ -30,7 +30,7 @@ tap.test('smartshell should stream a shell execution', async () => {
done.resolve(data);
});
let data = await done.promise;
// expect(data).toMatch(/[0-9\.]*/);
expect(data).toMatch(/[0-9\.]*/);
await execStreamingResponse.finalPromise;
});
@ -49,7 +49,7 @@ tap.test('should be able to find git', async () => {
});
tap.test('should spawn an interactive cli', async () => {
// await testSmartshell.execInteractive('echo "hi"');
await testSmartshell.execInteractive('echo "hi"');
});
tap.start({

View File

@ -3,6 +3,6 @@
*/
export const commitinfo = {
name: '@pushrocks/smartshell',
version: '3.0.0',
version: '3.0.1',
description: 'shell actions designed as promises'
}

View File

@ -39,38 +39,28 @@ export class Smartshell {
if (options.interactive) {
if (process.env.CI) {
return;
return;
}
const done = plugins.smartpromise.defer();
const shell = cp.spawn('sh', [], { stdio: 'pipe' });
const shell = cp.spawn('sh', [], { stdio: ['pipe', 'inherit', 'inherit'] });
this.smartexit.addProcess(shell);
const stdInStream = process.stdin.pipe(shell.stdin);
const stdOutStream = shell.stdout.pipe(process.stdout);
shell.on('close', (code) => {
console.log(`interactive shell terminated with code ${code}`);
stdInStream.removeAllListeners();
stdInStream.uncork();
stdOutStream.removeAllListeners();
stdOutStream.unpipe();
shell.kill('SIGTERM');
process.stdin.pause();
done.resolve();
console.log(`interactive shell terminated with code ${code}`);
this.smartexit.removeProcess(shell);
done.resolve();
});
let commandString = options.commandString;
if (process.env.CI) {
commandString += ' && exit';
}
commandString += '\n';
shell.stdin.write(commandString);
shell.stdin.write(commandString + '\n exit \n');
await done.promise;
return;
}
}
const done = plugins.smartpromise.defer<IExecResult | IExecResultStreaming>();
const childProcessEnded = plugins.smartpromise.defer<IExecResult>();