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.5.2 to 0.5.3

4

package.json

@@ -30,4 +30,4 @@ {

},
"version": "0.5.2",
"gitHead": "b7a89c8d7084e29502e4a2660c991338992eb773"
"version": "0.5.3",
"gitHead": "a6b165a87702eb29efcadfd1f27450b7daba2782"
}

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

constructor(public command: string, public fork = false, public opts: ChildOptions = {}) {
constructor(public command: string, public args: string[], public fork = false, public opts: ChildOptions = {}) {
super();

@@ -27,3 +27,3 @@ }

const [sub, complete] = op(this.command, finalOpts);
const [sub, complete] = op(this.command, this.args, finalOpts);

@@ -30,0 +30,0 @@ if (Env.isTrue('DEBUG')) {

@@ -51,3 +51,3 @@ import { Env } from '@travetto/base';

const cmd = this.config.processCommand ? this.config.processCommand(args) : args;
exec = ExecUtil.spawn(cmd.join(' '), { quiet: true });
exec = ExecUtil.spawn(cmd[0], cmd.slice(1), { quiet: true });
}

@@ -54,0 +54,0 @@ return exec as [CommonProcess, Promise<ExecutionResult>];

@@ -11,4 +11,4 @@ import * as child_process from 'child_process';

function exec(command: string, opts?: WithOpts<child_process.SpawnOptions>) {
return ExecUtil.spawn(command, { shell: false, ...opts })[1];
function exec(command: string, args: string[], opts?: WithOpts<child_process.SpawnOptions>) {
return ExecUtil.spawn(command, args, { shell: false, ...opts })[1];
}

@@ -74,8 +74,3 @@

private _cmd(op: 'create' | 'run' | 'start' | 'stop' | 'exec', ...args: any[]) {
const cmd = ([
this.cmd,
op,
...(args || []).map((x: any) => `${x}`)
]).join(' ');
const [proc, prom] = ExecUtil.spawn(cmd, { shell: this.tty });
const [proc, prom] = ExecUtil.spawn(this.cmd, [op, ...(args || [])], { shell: this.tty });
if (op !== 'run' && op !== 'exec') {

@@ -258,3 +253,3 @@ prom.catch(e => { this.evict = true; });

try {
await exec(`${this.cmd} kill ${this.container}`);
await exec(this.cmd, ['kill', this.container]);
} catch (e) { /* ignore */ }

@@ -265,3 +260,3 @@

try {
await exec(`${this.cmd} rm -fv ${this.container}`);
await exec(this.cmd, ['rm', '-fv', this.container]);
} catch (e) { /* ignore */ }

@@ -326,5 +321,5 @@

try {
const ids = (await exec(`${this.cmd} volume ls -qf dangling=true`)).stdout.trim();
const ids = (await exec(this.cmd, ['volume', 'ls', '-qf', 'dangling=true'])).stdout.trim();
if (ids) {
await exec(`${this.cmd} volume rm ${ids.split('\n').join(' ')}`);
await exec(this.cmd, ['volume', 'rm', ...ids.split('\n')]);
}

@@ -331,0 +326,0 @@ } catch (e) {

@@ -71,17 +71,19 @@ import * as cp from 'child_process';

static spawn(cmdStr: string, options: WithOpts<cp.SpawnOptions> = {}): [cp.ChildProcess, Promise<ExecutionResult>] {
const { cmd, args } = ExecUtil.getArgs(cmdStr);
static spawn(cmd: string, args: string[], options: WithOpts<cp.SpawnOptions> = {}): [cp.ChildProcess, Promise<ExecutionResult>] {
args = args.map(x => `${x}`);
const p = cp.spawn(cmd, args, { shell: true, ...(options as cp.SpawnOptions) });
return [p, ExecUtil.enhanceProcess(p, options, cmdStr)];
return [p, ExecUtil.enhanceProcess(p, options, `${cmd} ${args.join(' ')}`)];
}
static fork(cmdStr: string, options: WithOpts<cp.ForkOptions> = {}): [cp.ChildProcess, Promise<ExecutionResult>] {
const { cmd, args } = ExecUtil.getArgs(cmdStr);
static fork(cmd: string, args: string[], options: WithOpts<cp.ForkOptions> = {}): [cp.ChildProcess, Promise<ExecutionResult>] {
args = args.map(x => `${x}`);
const p = cp.fork(cmd, args, options);
return [p, ExecUtil.enhanceProcess(p, options, cmdStr)];
return [p, ExecUtil.enhanceProcess(p, options, `${cmd} ${args.join(' ')}`)];
}
static exec(cmd: string, options: WithOpts<cp.ExecOptions> = {}): [cp.ChildProcess, Promise<ExecutionResult>] {
const p = cp.exec(cmd, options);
return [p, ExecUtil.enhanceProcess(p, options, cmd)];
static exec(cmd: string, args: string[], options: WithOpts<cp.ExecOptions> = {}): [cp.ChildProcess, Promise<ExecutionResult>] {
args = args.map(x => `${x}`);
const cmdStr = `${cmd} ${args.join(' ')}`;
const p = cp.exec(cmdStr, options);
return [p, ExecUtil.enhanceProcess(p, options, cmdStr)];
}

@@ -88,0 +90,0 @@

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