Permalink
Browse files

Merge pull request #2 from speier/master

improved windows compatibility
  • Loading branch information...
2 parents f927f00 + 2ec7ed4 commit 1572dba0239e9687dc1e51a945a644df045a441f @mmalecki committed Nov 6, 2012
Showing with 6 additions and 2 deletions.
  1. +3 −2 examples/simple.js
  2. +3 −0 lib/spawn-command.js
View
@@ -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
@@ -1,10 +1,13 @@
+var util = require('util');
var spawn = require('child_process').spawn;
module.exports = function (command, options) {
var file, args;
if (process.platform === 'win32') {
file = 'cmd.exe';
args = ['/s', '/c', '"' + command + '"'];
+ options = util._extend({}, options);
+ options.windowsVerbatimArguments = true;
}
else {
file = '/bin/sh';

0 comments on commit 1572dba

Please sign in to comment.