mirror of
https://github.com/fofolee/uTools-ProcessKiller.git
synced 2025-09-28 23:24:15 +08:00
v0.0.2
This commit is contained in:
33
node_modules/proc-output/lib/index.js
generated
vendored
Normal file
33
node_modules/proc-output/lib/index.js
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* procOutput
|
||||
* Get the output of a process.
|
||||
*
|
||||
* @name procOutput
|
||||
* @function
|
||||
* @param {Process} proc The process object.
|
||||
* @param {Function} cb The callback function.
|
||||
* @returns {Process} The process object.
|
||||
*/
|
||||
|
||||
module.exports = function procOutput(proc, cb) {
|
||||
var stdout = "",
|
||||
stderr = "";
|
||||
|
||||
proc.on("error", function (err) {
|
||||
cb(err);
|
||||
});
|
||||
|
||||
proc.stdout.on("data", function (chunk) {
|
||||
return stdout += chunk;
|
||||
});
|
||||
proc.stderr.on("data", function (chunk) {
|
||||
return stderr += chunk;
|
||||
});
|
||||
proc.on("close", function (code) {
|
||||
return cb(null, stdout, stderr, code);
|
||||
});
|
||||
|
||||
return proc;
|
||||
};
|
Reference in New Issue
Block a user