Skip to content

Commit 6427e74

Browse files
committed
buffer maxSize reached, refactored
1 parent 3490fa4 commit 6427e74

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

data/lambda/index.js

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,19 @@
1-
var execFile = require("child_process").execFile;
1+
var spawn = require("child_process").spawn;
22

33
exports.handler = function(event, context) {
4-
child = execFile(event.file, event.args, function(error) {
5-
context.done(error, "Process complete!");
4+
child = spawn(event.file, event.args);
5+
6+
child.stdout.on("data", function (data) {
7+
console.log(data.toString())
8+
});
9+
child.stderr.on("data", function (data) {
10+
console.error(data.toString())
11+
});
12+
child.on("close", function(code) {
13+
if (code == 0) {
14+
context.succeed("Process complete!");
15+
} else {
16+
context.fail("Process failed with exit code: " + code);
17+
}
618
});
7-
child.stdout.on("data", console.log);
8-
child.stderr.on("data", console.error);
919
};

0 commit comments

Comments
 (0)