Skip to content

Commit

Permalink
fix buf
Browse files Browse the repository at this point in the history
  • Loading branch information
xudafeng committed Mar 17, 2016
1 parent 8151f92 commit 556dee5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
13 changes: 8 additions & 5 deletions lib/common/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,24 +32,27 @@ _.exec = function(cmd, opts) {

_.spawn = function() {
var args = Array.prototype.slice.call(arguments);
return new Promise(function(resolve, reject) {
return new Promise((resolve, reject) => {
var stdout = '';
var stderr = '';
var child = childProcess.spawn.apply(childProcess, args);

child.on('error', function(error) {
child.stdout.setEncoding('utf8');
child.stderr.setEncoding('utf8');

child.on('error', error => {
reject(error);
});

child.stdout.on('data', function(data) {
child.stdout.on('data', data => {
stdout += data;
});

child.stderr.on('data', function(data) {
child.stderr.on('data', data => {
stderr += data;
});

child.on('close', function(code) {
child.on('close', code => {
var error;
if (code) {
error = new Error(stderr);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "macaca-client",
"version": "1.0.9",
"version": "1.0.10",
"description": "macaca client for automation",
"keywords": [
"automation",
Expand Down

0 comments on commit 556dee5

Please sign in to comment.