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

teen_process

Package Overview
Dependencies
Maintainers
9
Versions
160
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

teen_process - npm Package Compare versions

Comparing version 2.0.0 to 2.0.1

15

build/lib/exec.js

@@ -27,3 +27,3 @@ "use strict";

const rep = (0, _shellQuote.quote)([cmd, ...args]);
opts = Object.assign({
opts = _lodash.default.defaults(opts, {
timeout: null,

@@ -41,3 +41,4 @@ encoding: 'utf8',

maxStderrBufferSize: MAX_BUFFER_SIZE
}, opts);
});
const isBuffer = Boolean(opts.isBuffer);
return await new _bluebird.default((resolve, reject) => {

@@ -134,3 +135,3 @@ let proc = (0, _child_process.spawn)(cmd, args, {

stderr
} = getStdio(opts.isBuffer);
} = getStdio(isBuffer);

@@ -159,3 +160,3 @@ if (code === 0) {

stderr
} = getStdio(opts.isBuffer);
} = getStdio(isBuffer);
let err = new Error(`Command '${rep}' timed out after ${opts.timeout}ms`);

@@ -175,5 +176,3 @@ err = Object.assign(err, {

var _default = exec;
exports.default = _default;require('source-map-support').install();
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibGliL2V4ZWMuanMiLCJuYW1lcyI6WyJNQVhfQlVGRkVSX1NJWkUiLCJleGVjIiwiY21kIiwiYXJncyIsIm9wdHMiLCJyZXAiLCJxdW90ZSIsIk9iamVjdCIsImFzc2lnbiIsInRpbWVvdXQiLCJlbmNvZGluZyIsImtpbGxTaWduYWwiLCJjd2QiLCJ1bmRlZmluZWQiLCJlbnYiLCJwcm9jZXNzIiwiaWdub3JlT3V0cHV0Iiwic3RkaW8iLCJpc0J1ZmZlciIsInNoZWxsIiwibG9nZ2VyIiwibWF4U3Rkb3V0QnVmZmVyU2l6ZSIsIm1heFN0ZGVyckJ1ZmZlclNpemUiLCJCIiwicmVzb2x2ZSIsInJlamVjdCIsInByb2MiLC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yxHQUFELENBQU47TUFDRDtJQUNGLENBWkQ7O0lBaUJBLElBQUk3QixJQUFJLENBQUNLLE9BQVQsRUFBa0I7TUFDaEJzQixLQUFLLEdBQUdnQyxVQUFVLENBQUMsTUFBTTtRQUN2QixJQUFJO1VBQUNSLE1BQUQ7VUFBU0M7UUFBVCxJQUFtQkYsUUFBUSxDQUFDcEMsUUFBRCxDQUEvQjtRQUNBLElBQUllLEdBQUcsR0FBRyxJQUFJSSxLQUFKLENBQVcsWUFBV2hDLEdBQUkscUJBQW9CRCxJQUFJLENBQUNLLE9BQVEsSUFBM0QsQ0FBVjtRQUNBd0IsR0FBRyxHQUFHNEIsTUFBTSxDQUFDQyxNQUFQLENBQWM3QixHQUFkLEVBQW1CO1VBQUNzQixNQUFEO1VBQVNDLE1BQVQ7VUFBaUJHLElBQUksRUFBRTtRQUF2QixDQUFuQixDQUFOO1FBQ0FqQyxNQUFNLENBQUNPLEdBQUQsQ0FBTjtRQUdBTixJQUFJLENBQUNxQyxJQUFMLENBQVU1RCxJQUFJLENBQUNPLFVBQWY7TUFDRCxDQVJpQixFQVFmUCxJQUFJLENBQUNLLE9BUlUsQ0FBbEI7SUFTRDtFQUNGLENBMUdZLENBQWI7QUEyR0Q7O2VBR2NSLEkifQ==

@@ -22,3 +22,3 @@ "use strict";

try {
_fs.default.accessSync(cwd, _fs.default.R_OK);
_fs.default.accessSync(cwd, _fs.default.constants.R_OK);
} catch (ign) {

@@ -33,5 +33,3 @@ error.message = `The current working directory '${cwd}' for '${cmd}' command ` + `either does not exist or is not accessible`;

return error;
}require('source-map-support').install();
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibGliL2hlbHBlcnMuanMiLCJuYW1lcyI6WyJmb3JtYXRFbm9lbnQiLCJlcnJvciIsImNtZCIsImN3ZCIsIndoaWNoIiwic3luYyIsImZzIiwiYWNjZXNzU3luYyIsIlJfT0siLCJpZ24iLCJtZXNzYWdlIl0sInNvd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0FBSSxZQUFuRCxHQUNiLDRDQURIO01BRUQ7SUFDRjtFQUNGLENBVkQsQ0FVRSxPQUFPUSxHQUFQLEVBQVk7SUFDWlQsS0FBSyxDQUFDVSxPQUFOLEdBQWlCLFlBQVdULEdBQUksK0JBQWhDO0VBQ0Q7O0VBQ0QsT0FBT0QsS0FBUDtBQUNEIn0=

@@ -31,5 +31,3 @@ "use strict";

} = execIndex;
exports.exec = exec;require('source-map-support').install();
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibGliL2luZGV4LmpzIiwibmFtZXMiOlsic3Bhd24iLCJjcCIsIlN1YlByb2Nlc3MiLCJzcEluZGV4IiwiZXhlYyIsImV4ZWNJbmRleCJdLCJzb3VyY2VSb290IjoiLi4vLi4iLCJzb3VyY2VzIjpbImxpYi9pbmRleC5qcyJdLCJzb3VyY2VzQ29udGVudCI6WyIvLyB0cmFuc3BpbGU6bWFpblxuaW1wb3J0ICogYXMgY3AgZnJvbSAnY2hpbGRfcHJvY2Vzcyc7XG5pbXBvcnQgKiBhcyBzcEluZGV4IGZyb20gJy4vc3VicHJvY2Vzcyc7XG5pbXBvcnQgKiBhcyBleGVjSW5kZXggZnJvbSAnLi9leGVjJztcblxuXG5jb25zdCB7IHNwYXduIH0gPSBjcDtcbmNvbnN0IHsgU3ViUHJvY2VzcyB9ID0gc3BJbmRleDtcbmNvbnN0IHsgZXhlYyB9ID0gZXhlY0luZGV4O1xuXG5leHBvcnQgeyBleGVjLCBzcGF3biwgU3ViUHJvY2VzcyB9O1xuIl0sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7QUFDQTs7QUFDQTs7QUFDQTs7Ozs7O0FBR0EsTUFBTTtFQUFFQTtBQUFGLElBQVlDLEVBQWxCOztBQUNBLE1BQU07RUFBRUM7QUFBRixJQUFpQkMsT0FBdkI7O0FBQ0EsTUFBTTtFQUFFQztBQUFGLElBQVdDLFNBQWpCIn0=
exports.exec = exec;
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJzcGF3biIsImNwIiwiU3ViUHJvY2VzcyIsInNwSW5kZXgiLCJleGVjIiwiZXhlY0luZGV4Il0sInNvdXJjZXMiOlsiLi4vLi4vbGliL2luZGV4LmpzIl0sInNvdXJjZXNDb250ZW50IjpbIi8vIHRyYW5zcGlsZTptYWluXG5pbXBvcnQgKiBhcyBjcCBmcm9tICdjaGlsZF9wcm9jZXNzJztcbmltcG9ydCAqIGFzIHNwSW5kZXggZnJvbSAnLi9zdWJwcm9jZXNzJztcbmltcG9ydCAqIGFzIGV4ZWNJbmRleCBmcm9tICcuL2V4ZWMnO1xuXG5cbmNvbnN0IHsgc3Bhd24gfSA9IGNwO1xuY29uc3QgeyBTdWJQcm9jZXNzIH0gPSBzcEluZGV4O1xuY29uc3QgeyBleGVjIH0gPSBleGVjSW5kZXg7XG5cbmV4cG9ydCB7IGV4ZWMsIHNwYXduLCBTdWJQcm9jZXNzIH07XG4iXSwibWFwcGluZ3MiOiI7Ozs7Ozs7OztBQUNBOztBQUNBOztBQUNBOzs7Ozs7QUFHQSxNQUFNO0VBQUVBO0FBQUYsSUFBWUMsRUFBbEI7O0FBQ0EsTUFBTTtFQUFFQztBQUFGLElBQWlCQyxPQUF2Qjs7QUFDQSxNQUFNO0VBQUVDO0FBQUYsSUFBV0MsU0FBakIifQ==

@@ -34,2 +34,10 @@ "use strict";

class SubProcess extends EventEmitter {
lastLinePortion;
proc;
args;
cmd;
opts;
expectingExit;
rep;
constructor(cmd, args = [], opts = {}) {

@@ -46,2 +54,6 @@ super();

this.rep = (0, _shellQuote.quote)([cmd, ...args]);
this.lastLinePortion = {
stdout: '',
stderr: ''
};
}

@@ -114,3 +126,3 @@

try {
if (startDetector && startDetector(stdout, stderr)) {
if (_lodash.default.isFunction(startDetector) && startDetector(stdout, stderr)) {
startDetector = null;

@@ -148,6 +160,8 @@ resolve();

this.proc.on('error', err => {
this.proc.removeAllListeners('exit');
this.proc.kill('SIGINT');
var _this$proc, _this$proc2, _this$proc3;
if (err.errno === 'ENOENT') {
(_this$proc = this.proc) === null || _this$proc === void 0 ? void 0 : _this$proc.removeAllListeners('exit');
(_this$proc2 = this.proc) === null || _this$proc2 === void 0 ? void 0 : _this$proc2.kill('SIGINT');
if (err.code === 'ENOENT') {
var _this$opts;

@@ -159,3 +173,3 @@

reject(err);
this.proc.unref();
(_this$proc3 = this.proc) === null || _this$proc3 === void 0 ? void 0 : _this$proc3.unref();
this.proc = null;

@@ -228,5 +242,7 @@ });

return await new _bluebird.default((resolve, reject) => {
this.proc.on('close', resolve);
var _this$proc4, _this$proc5;
(_this$proc4 = this.proc) === null || _this$proc4 === void 0 ? void 0 : _this$proc4.on('close', resolve);
this.expectingExit = true;
this.proc.kill(signal);
(_this$proc5 = this.proc) === null || _this$proc5 === void 0 ? void 0 : _this$proc5.kill(signal);
setTimeout(() => {

@@ -244,4 +260,6 @@ reject(new Error(`Process didn't end after ${timeout}ms (cmd: '${this.rep}')`));

return await new _bluebird.default((resolve, reject) => {
this.proc.on('exit', code => {
if (allowedExitCodes.indexOf(code) === -1) {
var _this$proc6;
(_this$proc6 = this.proc) === null || _this$proc6 === void 0 ? void 0 : _this$proc6.on('exit', code => {
if (code !== null && allowedExitCodes.indexOf(code) === -1) {
reject(new Error(`Process ended with exitcode ${code} (cmd: '${this.rep}')`));

@@ -273,5 +291,3 @@ } else {

var _default = SubProcess;
exports.default = _default;require('source-map-support').install();
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibGliL3N1YnByb2Nlc3MuanMiLCJuYW1lcyI6WyJFdmVudEVtaXR0ZXIiLCJldmVudHMiLCJNQVhfTElORV9QT1JUSU9OX0xFTkdUSCIsImN1dFN1ZmZpeCIsInN0ciIsInN1ZmZpeExlbmd0aCIsImxlbmd0aCIsInN1YnN0ciIsIlN1YlByb2Nlc3MiLCJjb25zdHJ1Y3RvciI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MsT0FBRCxFQUFVQyxNQUFWLEtBQXFCO01BQUE7O01BQ3RDLG9CQUFLaEMsSUFBTCw0REFBV2tELEVBQVgsQ0FBYyxNQUFkLEVBQXVCSSxJQUFELElBQVU7UUFDOUIsSUFBSUEsSUFBSSxLQUFLLElBQVQsSUFBaUJlLGdCQUFnQixDQUFDQyxPQUFqQixDQUF5QmhCLElBQXpCLE1BQW1DLENBQUMsQ0FBekQsRUFBNEQ7VUFDMUR0QixNQUFNLENBQUMsSUFBSXpCLEtBQUosQ0FBVywrQkFBOEIrQyxJQUFLLFdBQVUsS0FBS2pELEdBQUksSUFBakUsQ0FBRCxDQUFOO1FBQ0QsQ0FGRCxNQUVPO1VBQ0wwQixPQUFPLENBQUN1QixJQUFELENBQVA7UUFDRDtNQUNGLENBTkQ7SUFPRCxDQVJZLENBQWI7RUFTRDs7RUFLRGlCLGFBQWEsR0FBSTtJQUNmLElBQUksQ0FBQyxLQUFLcEUsSUFBTCxDQUFVMEIsUUFBZixFQUF5QjtNQUV2QixNQUFNLElBQUl0QixLQUFKLENBQVcscUVBQVgsQ0FBTjtJQUNEOztJQUNELElBQUksS0FBS1AsSUFBVCxFQUFlO01BQ2IsS0FBS0EsSUFBTCxDQUFVeUQsS0FBVjtJQUNEO0VBQ0Y7O0VBRU0sSUFBSGUsR0FBRyxHQUFJO0lBQ1QsT0FBTyxLQUFLeEUsSUFBTCxHQUFZLEtBQUtBLElBQUwsQ0FBVXdFLEdBQXRCLEdBQTRCLElBQW5DO0VBQ0Q7O0FBdFRtQzs7O2VBMFR2QjFFLFUifQ==

@@ -1,3 +0,1 @@

// @ts-check
/* eslint-disable promise/prefer-await-to-callbacks */

@@ -27,3 +25,3 @@

// for use here with spawn under the hood
opts = Object.assign({
opts = /** @type {T} */(_.defaults(opts, {
timeout: null,

@@ -41,4 +39,6 @@ encoding: 'utf8',

maxStderrBufferSize: MAX_BUFFER_SIZE,
}, opts);
}));
const isBuffer = Boolean(opts.isBuffer);
// this is an async function, so return a promise

@@ -127,3 +127,3 @@ return await new B((resolve, reject) => {

}
let {stdout, stderr} = getStdio(opts.isBuffer);
let {stdout, stderr} = getStdio(isBuffer);
if (code === 0) {

@@ -143,3 +143,3 @@ resolve(/** @type {BufferProp<T> extends true ? TeenProcessExecBufferResult : TeenProcessExecStringResult} */({stdout, stderr, code}));

timer = setTimeout(() => {
let {stdout, stderr} = getStdio(opts.isBuffer);
let {stdout, stderr} = getStdio(isBuffer);
let err = new Error(`Command '${rep}' timed out after ${opts.timeout}ms`);

@@ -146,0 +146,0 @@ err = Object.assign(err, {stdout, stderr, code: null});

@@ -20,3 +20,3 @@ import which from 'which';

try {
fs.accessSync(cwd, fs.R_OK);
fs.accessSync(cwd, fs.constants.R_OK);
} catch (ign) {

@@ -23,0 +23,0 @@ error.message = `The current working directory '${cwd}' for '${cmd}' command ` +

@@ -26,2 +26,39 @@ /* eslint-disable promise/prefer-await-to-callbacks */

class SubProcess extends EventEmitter {
/**
* @type { {stdout: string, stderr: string} }
*/
lastLinePortion;
/** @type {import('child_process').ChildProcess?} */
proc;
/** @type {string[]} */
args;
/**
* @type {string}
*/
cmd;
/**
* @type {any}
*/
opts;
/**
* @type {boolean}
*/
expectingExit;
/**
* @type {string}
*/
rep;
/**
* @param {string} cmd
* @param {string[]} [args]
* @param {any} [opts]
*/
constructor (cmd, args = [], opts = {}) {

@@ -41,2 +78,4 @@ super();

this.rep = quote([cmd, ...args]);
this.lastLinePortion = {stdout: '', stderr: ''};
}

@@ -49,2 +88,7 @@

/**
*
* @param {string} stream
* @param {Iterable<string>} lines
*/
emitLines (stream, lines) {

@@ -58,8 +102,15 @@ for (let line of lines) {

// "started"
/**
*
* @param {StartDetector|number?} startDetector
* @param {number?} timeoutMs
* @param {boolean} detach
* @returns {Promise<void>}
*/
async start (startDetector = null, timeoutMs = null, detach = false) {
let startDelay = 10;
const genericStartDetector = function genericStartDetector (stdout, stderr) {
const genericStartDetector = /** @type {StartDetector} */(function genericStartDetector (stdout, stderr) {
return stdout || stderr;
};
});

@@ -107,2 +158,6 @@ // the default start detector simply returns true when we get any output

// this function handles output that we collect from the subproc
/**
*
* @param { {stdout: string, stderr: string} } streams
*/
const handleOutput = (streams) => {

@@ -113,3 +168,3 @@ const {stdout, stderr} = streams;

try {
if (startDetector && startDetector(stdout, stderr)) {
if (_.isFunction(startDetector) && startDetector(stdout, stderr)) {
startDetector = null;

@@ -129,3 +184,3 @@ resolve();

// remember a line that started but did not finish in the last chunk)
for (const [streamName, streamData] of _.toPairs(streams)) {
for (const [streamName, streamData] of /** @type {[['stdout', string], ['stderr', string]]} */(_.toPairs(streams))) {
if (!streamData) continue; // eslint-disable-line curly

@@ -153,7 +208,7 @@ const lines = streamData.split('\n')

// if we get an error spawning the proc, reject and clean up the proc
this.proc.on('error', (err) => {
this.proc.removeAllListeners('exit');
this.proc.kill('SIGINT');
this.proc.on('error', /** @param {NodeJS.ErrnoException} err */ (err) => {
this.proc?.removeAllListeners('exit');
this.proc?.kill('SIGINT');
if (err.errno === 'ENOENT') {
if (err.code === 'ENOENT') {
err = formatEnoent(err, this.cmd, this.opts?.cwd);

@@ -163,3 +218,3 @@ }

this.proc.unref();
this.proc?.unref();
this.proc = null;

@@ -233,2 +288,8 @@ });

/**
*
* @param {NodeJS.Signals} signal
* @param {number} timeout
* @returns {Promise<void>}
*/
async stop (signal = 'SIGTERM', timeout = 10000) {

@@ -242,5 +303,5 @@ if (!this.isRunning) {

return await new B((resolve, reject) => {
this.proc.on('close', resolve);
this.proc?.on('close', resolve);
this.expectingExit = true;
this.proc.kill(signal);
this.proc?.kill(signal);
// this timeout needs unref() or node will wait for the timeout to fire before

@@ -260,4 +321,4 @@ // exiting the process.

return await new B((resolve, reject) => {
this.proc.on('exit', (code) => {
if (allowedExitCodes.indexOf(code) === -1) {
this.proc?.on('exit', (code) => {
if (code !== null && allowedExitCodes.indexOf(code) === -1) {
reject(new Error(`Process ended with exitcode ${code} (cmd: '${this.rep}')`));

@@ -291,1 +352,8 @@ } else {

export default SubProcess;
/**
* @callback StartDetector
* @param {string} stdout
* @param {string} [stderr]
* @returns {any}
*/
{
"name": "teen_process",
"version": "2.0.1",
"description": "A grown up version of Node's spawn/exec",
"keywords": [
"child_process",
"process management"
"process management",
"subprocess",
"spawn",
"exec",
"process",
"child"
],
"version": "2.0.0",
"author": "appium",
"license": "Apache-2.0",
"bugs": {
"url": "https://github.com/appium/node-teen_process/issues"
},
"repository": {

@@ -15,9 +21,4 @@ "type": "git",

},
"bugs": {
"url": "https://github.com/appium/node-teen_process/issues"
},
"engines": {
"node": ">=14",
"npm": ">=6"
},
"license": "Apache-2.0",
"author": "Appium Contributors",
"main": "./index.js",

@@ -33,38 +34,70 @@ "bin": {},

],
"dependencies": {
"@babel/runtime": "^7.0.0",
"bluebird": "^3.5.1",
"lodash": "^4.17.4",
"shell-quote": "^1.4.3",
"source-map-support": "^0.5.3",
"which": "^2.0.2"
},
"scripts": {
"clean": "rm -rf node_modules && rm -f package-lock.json && npm install",
"build": "gulp transpile",
"prepare": "gulp prepublish",
"test": "gulp once",
"watch": "gulp",
"lint": "gulp eslint",
"lint:fix": "gulp eslint --fix",
"build": "babel --out-dir=build/lib lib",
"dev": "npm run build -- --watch",
"lint": "eslint .",
"lint:fix": "npm run lint -- --fix",
"lint:types": "tsc",
"precommit-lint": "lint-staged",
"precommit-msg": "echo 'Pre-commit checks...' && exit 0",
"precommit-test": "REPORTER=dot gulp once"
"prepare": "npm run build",
"test": "mocha"
},
"pre-commit": [
"precommit-msg",
"precommit-test"
"precommit-lint"
],
"lint-staged": {
"*.js": [
"eslint --fix"
]
},
"prettier": {
"bracketSpacing": false,
"printWidth": 100,
"singleQuote": true
},
"dependencies": {
"@babel/runtime": "7.18.9",
"bluebird": "3.7.2",
"lodash": "4.17.21",
"shell-quote": "1.7.3",
"source-map-support": "0.5.21",
"which": "2.0.2"
},
"devDependencies": {
"@appium/eslint-config-appium": "^6.0.2",
"@appium/gulp-plugins": "^7.0.2",
"@appium/support": "^2.59.2",
"@types/bluebird": "^3.5.36",
"@types/lodash": "^4.14.177",
"@types/node": "^17.0.0",
"@types/shell-quote": "^1.7.1",
"chai": "^4.1.2",
"chai-as-promised": "^7.1.1",
"gulp": "^4.0.0",
"pre-commit": "^1.2.2"
"@appium/eslint-config-appium": "6.0.4",
"@appium/support": "2.59.5",
"@babel/cli": "7.18.10",
"@babel/core": "7.18.10",
"@babel/eslint-parser": "7.18.9",
"@babel/plugin-transform-runtime": "7.18.10",
"@babel/preset-env": "7.18.10",
"@babel/register": "7.18.9",
"@types/bluebird": "3.5.36",
"@types/chai": "4.3.3",
"@types/chai-as-promised": "7.1.5",
"@types/lodash": "4.14.182",
"@types/mocha": "9.1.1",
"@types/node": "18.6.5",
"@types/shell-quote": "1.7.1",
"@types/which": "2.0.1",
"babel-plugin-source-map-support": "2.2.0",
"chai": "4.3.6",
"chai-as-promised": "7.1.1",
"eslint": "7.32.0",
"eslint-config-prettier": "8.5.0",
"eslint-plugin-import": "2.26.0",
"eslint-plugin-mocha": "9.0.0",
"eslint-plugin-promise": "6.0.0",
"lint-staged": "13.0.3",
"mocha": "10.0.0",
"pre-commit": "1.2.2",
"prettier": "2.7.1",
"typescript": "4.7.4"
},
"engines": {
"node": ">=14",
"npm": ">=6"
}
}
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