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

teen_process

Package Overview
Dependencies
Maintainers
1
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 1.2.0 to 1.2.1

lib/.test.js.un~

30

build/lib/teen_process.js

@@ -126,4 +126,6 @@ 'use strict';

if (typeof cmd !== 'string') throw new Error('Command must be a string');
if (!(args instanceof Array)) throw new Error('Args must be an array');
this.cmd = cmd;
this.args = args;
this.proc = null;
}

@@ -167,2 +169,3 @@

_this.proc.stderr.setEncoding('utf8');
var lastLinePortion = { stdout: '', stderr: '' };

@@ -178,2 +181,16 @@ var handleOutput = function handleOutput(data) {

_this.emit('output', data.stdout, data.stderr);
var _arr = ['stdout', 'stderr'];
for (var _i = 0; _i < _arr.length; _i++) {
var stream = _arr[_i];
if (!data[stream]) continue;
var lines = data[stream].split('\n');
if (lines.length > 1) {
var retLines = lines.slice(0, -1);
retLines[0] = lastLinePortion[stream] + retLines[0];
lastLinePortion[stream] = lines[lines.length - 1];
_this.emit('lines-' + stream, retLines);
} else {
lastLinePortion[stream] += lines[0];
}
}
};

@@ -197,2 +214,3 @@

_this.emit('exit', code, signal);
_this.proc = null;
});

@@ -223,2 +241,10 @@

case 0:
if (this.proc) {
context$2$0.next = 2;
break;
}
throw new Error('Can\'t stop process; it\'s not currently running');
case 2:
return context$2$0.abrupt('return', new _Promise(function (resolve, reject) {

@@ -232,3 +258,3 @@ _this2.proc.on('close', resolve);

case 1:
case 3:
case 'end':

@@ -247,2 +273,2 @@ return context$2$0.stop();

exports.SubProcess = SubProcess;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImxpYi90ZWVuX3Byb2Nlc3MuanMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7OzZCQUFzQ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ihcIkNhbid0IHN0b3AgcHJvY2VzczsgaXQncyBub3QgY3VycmVudGx5IHJ1bm5pbmdcIik7XG4gICAgfVxuICAgIHJldHVybiBuZXcgUHJvbWlzZSgocmVzb2x2ZSwgcmVqZWN0KSA9PiB7XG4gICAgICB0aGlzLnByb2Mub24oJ2Nsb3NlJywgcmVzb2x2ZSk7XG4gICAgICB0aGlzLnByb2Mua2lsbChzaWduYWwpO1xuICAgICAgc2V0VGltZW91dCgoKSA9PiB7XG4gICAgICAgIHJlamVjdChuZXcgRXJyb3IoYFByb2Nlc3MgZGlkbid0IGVuZCBhZnRlciAke3RpbWVvdXR9bXNgKSk7XG4gICAgICB9LCB0aW1lb3V0KTtcbiAgICB9KTtcbiAgfVxufVxuXG5leHBvcnQgeyBleGVjLCBzcGF3biwgU3ViUHJvY2VzcyB9O1xuIl19

@@ -52,2 +52,13 @@ 'use strict';

});
it('should throw an error if initialized with bad args', function () {
should['throw'](function () {
new _.SubProcess('ls', 'foo');
});
should['throw'](function () {
new _.SubProcess('ls', 1);
});
should['throw'](function () {
new _.SubProcess('ls', {});
});
});
it('should default args list to []', function () {

@@ -129,7 +140,22 @@ var x = new _.SubProcess('ls');

});
it('should be able to provide a custom startDetector function', function callee$2$3() {
var sd, hasData, s;
it('should fail even with a start timeout of 0 when command is bad', function callee$2$3() {
var s;
return _regeneratorRuntime.async(function callee$2$3$(context$3$0) {
while (1) switch (context$3$0.prev = context$3$0.next) {
case 0:
s = new _.SubProcess('blargimarg');
context$3$0.next = 3;
return s.start(0).should.eventually.be.rejectedWith(/ENOENT/);
case 3:
case 'end':
return context$3$0.stop();
}
}, null, _this);
});
it('should be able to provide a custom startDetector function', function callee$2$4() {
var sd, hasData, s;
return _regeneratorRuntime.async(function callee$2$4$(context$3$0) {
while (1) switch (context$3$0.prev = context$3$0.next) {
case 0:
sd = function sd(stdout) {

@@ -226,2 +252,30 @@ return stdout;

});
it('should get output by lines', function callee$2$1() {
var lines;
return _regeneratorRuntime.async(function callee$2$1$(context$3$0) {
while (1) switch (context$3$0.prev = context$3$0.next) {
case 0:
subproc = new _.SubProcess('ls', [_path2['default'].resolve(__dirname)]);
lines = [];
subproc.on('lines-stdout', function (newLines) {
lines = lines.concat(newLines);
});
context$3$0.next = 5;
return subproc.start(0);
case 5:
context$3$0.next = 7;
return _bluebird2['default'].delay(50);
case 7:
lines.should.eql(['exec-specs.js', 'fixtures', 'helpers.js', 'subproc-specs.js']);
case 8:
case 'end':
return context$3$0.stop();
}
}, null, _this);
});
});

@@ -290,4 +344,32 @@

});
it('should error if there is no process to stop', function callee$2$2() {
var subproc;
return _regeneratorRuntime.async(function callee$2$2$(context$3$0) {
while (1) switch (context$3$0.prev = context$3$0.next) {
case 0:
subproc = new _.SubProcess('ls');
context$3$0.next = 3;
return subproc.stop().should.eventually.be.rejectedWith(/Can't stop/);
case 3:
context$3$0.next = 5;
return subproc.start();
case 5:
context$3$0.next = 7;
return _bluebird2['default'].delay(10);
case 7:
context$3$0.next = 9;
return subproc.stop().should.eventually.be.rejectedWith(/Can't stop/);
case 9:
case 'end':
return context$3$0.stop();
}
}, null, _this);
});
});
});
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInRlc3Qvc3VicHJvYy1zcGVjcy5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7O3dCQUVjLFVBQVU7Ozs7b0JBQ1AsTUFBTTs7OztnQkFDSSxPQUFPOztvQkFDakIsTUFBTTs7Ozs4QkFDSSxrQkFBa0I7Ozs7UUFDdEMsV0FBVzs7dUJBQ1MsV0FBVzs7QUFSdEMsT0FBTyxDQUFDLG9CQUFvQixDQUFDLENBQUMsT0FBTyxFQUFFLENBQUM7O0FBVXhDLElBQU0sTUFBTSxHQUFHLGtCQUFLLE1BQU0sRUFBRSxDQUFDO0FBQzdCLGtCQUFLLEdBQUcsNkJBQWdCLENBQUM7O0FBRXpCLFFBQVEsQ0FBQyxZQUFZ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YnByb2Muc3RvcCgpLnNob3VsZC5ldmVudHVhbGx5LmJlLnJlamVjdGVkV2l0aCgvQ2FuJ3Qgc3RvcC8pO1xuICAgIH0pO1xuICB9KTtcbn0pO1xuIl19

@@ -86,4 +86,6 @@ import { spawn } from 'child_process';

if (typeof cmd !== "string") throw new Error("Command must be a string");
if (!(args instanceof Array)) throw new Error("Args must be an array");
this.cmd = cmd;
this.args = args;
this.proc = null;
}

@@ -116,2 +118,3 @@

this.proc.stderr.setEncoding('utf8');
let lastLinePortion = {stdout: "", stderr: ""};

@@ -127,2 +130,14 @@ const handleOutput = (data) => {

this.emit('output', data.stdout, data.stderr);
for (let stream of ['stdout', 'stderr']) {
if (!data[stream]) continue;
let lines = data[stream].split("\n");
if (lines.length > 1) {
let retLines = lines.slice(0, -1);
retLines[0] = lastLinePortion[stream] + retLines[0];
lastLinePortion[stream] = lines[lines.length - 1];
this.emit(`lines-${stream}`, retLines);
} else {
lastLinePortion[stream] += lines[0];
}
}
};

@@ -146,2 +161,3 @@

this.emit('exit', code, signal);
this.proc = null;
});

@@ -158,2 +174,5 @@

async stop (signal = 'SIGTERM', timeout = 10000) {
if (!this.proc) {
throw new Error("Can't stop process; it's not currently running");
}
return new Promise((resolve, reject) => {

@@ -160,0 +179,0 @@ this.proc.on('close', resolve);

2

package.json

@@ -8,3 +8,3 @@ {

],
"version": "1.2.0",
"version": "1.2.1",
"author": "appium",

@@ -11,0 +11,0 @@ "license": "Apache License 2.0",

@@ -84,3 +84,4 @@ node-teen_process

You can listen to 2 events, `output`, and `exit`:
You can listen to 4 events, `output`, `exit`, `lines-stdout`, and
`lines-stderr`:

@@ -97,2 +98,9 @@ ```js

});
// lines-stderr is just the same
proc.on('lines-stdout', lines => {
console.log(lines);
// ['foo', 'bar', 'baz']
// automatically handles rejoining lines across stream chunks
});
```

@@ -99,0 +107,0 @@

@@ -28,2 +28,13 @@ // transpile:mocha

});
it('should throw an error if initialized with bad args', () => {
should.throw(() => {
new SubProcess('ls', 'foo');
});
should.throw(() => {
new SubProcess('ls', 1);
});
should.throw(() => {
new SubProcess('ls', {});
});
});
it('should default args list to []', () => {

@@ -63,2 +74,6 @@ let x = new SubProcess('ls');

});
it('should fail even with a start timeout of 0 when command is bad', async () => {
let s = new SubProcess('blargimarg');
await s.start(0).should.eventually.be.rejectedWith(/ENOENT/);
});
it('should be able to provide a custom startDetector function', async () => {

@@ -104,2 +119,14 @@ let sd = (stdout) => { return stdout; };

});
it('should get output by lines', async () => {
subproc = new SubProcess('ls', [path.resolve(__dirname)]);
let lines = [];
subproc.on('lines-stdout', (newLines) => {
lines = lines.concat(newLines);
});
await subproc.start(0);
await B.delay(50);
lines.should.eql(['exec-specs.js', 'fixtures', 'helpers.js',
'subproc-specs.js']);
});
});

@@ -131,3 +158,11 @@

});
it('should error if there is no process to stop', async () => {
let subproc = new SubProcess('ls');
await subproc.stop().should.eventually.be.rejectedWith(/Can't stop/);
await subproc.start();
await B.delay(10);
await subproc.stop().should.eventually.be.rejectedWith(/Can't stop/);
});
});
});

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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