node-git-wrapper icon indicating copy to clipboard operation
node-git-wrapper copied to clipboard

Use spawn instead of exec.

Open barwin opened this issue 10 years ago • 2 comments

This way it's not subject to stdout maxBuffer restrictions that come with exec.

Fixes issue #6

barwin avatar Jan 15 '15 01:01 barwin

Line https://github.com/pvorb/node-git-wrapper/pull/7/files#diff-bff8ce0d1a86c39ee4d6995bd85b746fR86 fails with commands like git -C ./path status, fixed here https://github.com/adelriosantiago/node-git-wrapper/blob/master/git.js#L87

Other than that, everything seems to work fine, spawn works fine and the 200k limit is gone.

adelriosantiago avatar Jan 10 '16 07:01 adelriosantiago

@adelriosantiago - On your line 87, I worry you may have accidentally put the new command outside the existing else if block because there are no curly brackets around it.

What I mean is, what you have here:

else if (val !== false)
        args.push('-'+k);
        args.push(val);

Probably meant to be:

else if (val !== false) {
        args.push('-'+k);
        args.push(val);
}

.. Could also keep it single line because .push can accept multiple elements:

args.push('-'+k, val);

It used to be a single-line else if block so the curlies weren't necessary before.

Disclaimer: I've not tested this and this P/R is about a year old so I'm coming back in with a hazy memory :)

barwin avatar Jan 11 '16 23:01 barwin