Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@travetto/exec

Package Overview
Dependencies
Maintainers
1
Versions
110
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@travetto/exec - npm Package Compare versions

Comparing version 0.7.3 to 1.0.0-beta.1

6

package.json

@@ -11,3 +11,3 @@ {

"dependencies": {
"@travetto/base": "^0.7.3"
"@travetto/base": "^1.0.0-beta.1"
},

@@ -33,4 +33,4 @@ "homepage": "https://travetto.io",

},
"version": "0.7.3",
"gitHead": "3c47f7e9a053d761152c9f9c72653d041577b0c3"
"version": "1.0.0-beta.1",
"gitHead": "81e362a7d911693c635d2c077f3a03229c74d331"
}

@@ -19,3 +19,3 @@ import * as fs from 'fs';

private dockerCmd: string = 'docker';
private execState: ExecutionState;
private pendingExecutions = new Set<ExecutionState>();

@@ -46,3 +46,3 @@ private container: string;

this.evict = true;
delete this.execState;
this.pendingExecutions.clear();
}

@@ -60,3 +60,4 @@ throw e;

get id() {
return this.execState && !this.execState.process.killed ? this.execState.process.pid : -1;
const first = this.pendingExecutions.size > 0 ? this.pendingExecutions.values().next().value : undefined;
return first && !first.process.killed ? first.process.pid : -1;
}

@@ -195,4 +196,6 @@

let prom = toStop;
if (this.execState) {
prom = Promise.all([toStop, this.execState.result]).then(x => x[0]);
if (this.pendingExecutions) {
const pendingResults = [...this.pendingExecutions.values()].map(e => e.result);
this.pendingExecutions.clear();
prom = Promise.all([toStop, ...pendingResults]).then(([first]) => first);
}

@@ -204,5 +207,8 @@ return prom;

const flags = this.getRuntimeFlags(extraFlags);
this.execState = this.runCmd('exec', ...flags, this.container, ...(args || []));
this.execState.result = this.execState.result.finally(() => delete this.execState);
return this.execState;
const execState = this.runCmd('exec', ...flags, this.container, ...(args || []));
this.pendingExecutions.add(execState);
execState.result = execState.result.finally(() => this.pendingExecutions.delete(execState));
return execState;
}

@@ -220,6 +226,9 @@

const state = this.runCmd('run', `--name=${this.container}`, ...this.getFlags(flags), this.image, ...(args || []));
this.execState = this.watchForEviction(state);
this.execState.process.unref();
return this.execState.result;
const execState = this.runCmd('run', `--name=${this.container}`, ...this.getFlags(flags), this.image, ...(args || []));
this.pendingExecutions.add(execState);
this.watchForEviction(execState);
execState.process.unref();
return execState.result.finally(() => this.pendingExecutions.delete(execState));
}

@@ -245,6 +254,6 @@

if (this.execState) {
const state = this.execState;
delete this.execState;
await state.result;
if (this.pendingExecutions.size) {
const results = [...this.pendingExecutions.values()].map(x => x.result);
this.pendingExecutions.clear();
await Promise.all(results);
}

@@ -251,0 +260,0 @@

@@ -16,3 +16,3 @@ import * as child_process from 'child_process';

let done = false;
const finish = async function (result: ExecutionResult) {
const finish = function (result: ExecutionResult) {
if (done) {

@@ -19,0 +19,0 @@ return;

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc