Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #2 from speier/master

improved windows compatibility
  • Loading branch information...
commit 1572dba0239e9687dc1e51a945a644df045a441f 2 parents f927f00 + 2ec7ed4
@mmalecki authored
Showing with 6 additions and 2 deletions.
  1. +3 −2 examples/simple.js
  2. +3 −0  lib/spawn-command.js
View
5 examples/simple.js
@@ -1,5 +1,6 @@
-var spawnCommand = require('../');
- child = spawnCommand('echo "Hello spawn" | base64');
+var spawnCommand = require('../'),
+ command = (process.platform === 'win32') ? 'echo "Hello spawn"' : 'echo "Hello spawn" | base64',
+ child = spawnCommand(command);
child.stdout.on('data', function (data) {
console.log('data', data.toString());
View
3  lib/spawn-command.js
@@ -1,3 +1,4 @@
+var util = require('util');
var spawn = require('child_process').spawn;
module.exports = function (command, options) {
@@ -5,6 +6,8 @@ module.exports = function (command, options) {
if (process.platform === 'win32') {
file = 'cmd.exe';
args = ['/s', '/c', '"' + command + '"'];
+ options = util._extend({}, options);
+ options.windowsVerbatimArguments = true;
}
else {
file = '/bin/sh';
Please sign in to comment.
Something went wrong with that request. Please try again.