spawn-command
Advanced tools
Comparing version 0.0.1 to 0.0.2
@@ -1,3 +0,4 @@ | ||
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); | ||
@@ -4,0 +5,0 @@ child.stdout.on('data', function (data) { |
@@ -0,1 +1,2 @@ | ||
var util = require('util'); | ||
var spawn = require('child_process').spawn; | ||
@@ -8,2 +9,4 @@ | ||
args = ['/s', '/c', '"' + command + '"']; | ||
options = util._extend({}, options); | ||
options.windowsVerbatimArguments = true; | ||
} | ||
@@ -10,0 +13,0 @@ else { |
@@ -5,7 +5,10 @@ { | ||
"description": "Spawn commands like `child_process.exec` does but return a `ChildProcess`", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"main": "./lib/spawn-command", | ||
"scripts": { | ||
"test": "node test/spawn-command-test.js" | ||
}, | ||
"devDependencies": { | ||
"assert-called": "0.1.x" | ||
} | ||
} |
@@ -13,3 +13,3 @@ # spawn-command [![Build Status](https://secure.travis-ci.org/mmalecki/spawn-command.png)](http://travis-ci.org/mmalecki/spawn-command) | ||
child.on('stdout', function (data) { | ||
child.stdout.on('data', function (data) { | ||
console.log('data', data); | ||
@@ -16,0 +16,0 @@ }); |
var path = require('path'), | ||
assert = require('assert'), | ||
assertCalled = require('assert-called'), | ||
spawnCommand = require('../'); | ||
var child = spawnCommand('grep commit < ' + path.join(__dirname, 'fixtures', 'commit')), | ||
var win32 = (process.platform === 'win32'), | ||
newln = win32 ? '\r\n' : '\n', | ||
grep = win32 ? 'findstr' : 'grep', | ||
child = spawnCommand(grep + ' commit < ' + path.join(__dirname, 'fixtures', 'commit')), | ||
stderr = '', | ||
@@ -18,11 +22,6 @@ stdout = '', | ||
child.on('exit', function (exitCode) { | ||
exited = true; | ||
child.on('exit', assertCalled(function (exitCode) { | ||
assert.equal(exitCode, 0); | ||
assert.equal(stdout, 'commit 26b11915b1c16440468a4b5f4b07d2409b98c68c\n'); | ||
assert.equal(stdout, 'commit 26b11915b1c16440468a4b5f4b07d2409b98c68c' + newln); | ||
assert.equal(stderr, ''); | ||
}); | ||
process.on('exit', function () { | ||
assert(exited); | ||
}); | ||
})); |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3936
47
1