Skip to content

Commit

Permalink
v2.2.11. Improvement.
Browse files Browse the repository at this point in the history
- v2.2.11 January 10, 2014
	- Added `outputPrefix` option for `safeps.spawn`
  • Loading branch information
balupton committed Jan 10, 2014
1 parent 90b88e9 commit 7eb2523
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 7 deletions.
3 changes: 3 additions & 0 deletions HISTORY.md
@@ -1,5 +1,8 @@
# History

- v2.2.11 January 10, 2014
- Added `outputPrefix` option for `safeps.spawn`

- v2.2.10 December 27, 2013
- Updated dependencies

Expand Down
7 changes: 6 additions & 1 deletion README.md
Expand Up @@ -10,9 +10,12 @@

[![Build Status](http://img.shields.io/travis-ci/bevry/safeps.png?branch=master)](http://travis-ci.org/bevry/safeps "Check this project's build status on TravisCI")
[![NPM version](http://badge.fury.io/js/safeps.png)](https://npmjs.org/package/safeps "View this project on NPM")
[![Dependency Status](https://david-dm.org/bevry/safeps.png?theme=shields.io)](https://david-dm.org/bevry/safeps)
[![Development Dependency Status](https://david-dm.org/bevry/safeps/dev-status.png?theme=shields.io)](https://david-dm.org/bevry/safeps#info=devDependencies)<br/>
[![Gittip donate button](http://img.shields.io/gittip/bevry.png)](https://www.gittip.com/bevry/ "Donate weekly to this project using Gittip")
[![Flattr donate button](http://img.shields.io/flattr/donate.png?color=yellow)](http://flattr.com/thing/344188/balupton-on-Flattr "Donate monthly to this project using Flattr")
[![PayPayl donate button](http://img.shields.io/paypal/donate.png?color=yellow)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=QB8GQPZAH84N6 "Donate once-off to this project using Paypal")
[![BitCoin donate button](http://img.shields.io/bitcoin/donate.png?color=yellow)](https://coinbase.com/checkouts/9ef59f5479eec1d97d63382c9ebcb93a "Donate once-off to this project using BitCoin")

<!-- /BADGES -->

Expand Down Expand Up @@ -50,7 +53,8 @@ var safeps = require('safeps');
- `opts={safe:true, read:true, output:false, stdin:null}` options are also sent on to `require('child_process').spawn`
- `safe` whether or not we should attempt to get the absolute executable path of the command to execute via `require('safeps').getExecPath`
- `read` whether or not we should listen to the child process's stdout and stderr streams for use in the completion callback
- `output` if set to `true` will output the child process's stdout to our process's stdout
- `output` if set to `true` will output the child process's stdout to our process's stdout, and provide those values in the completion callback
- `outputPrefix` if set to a string, this string will be outputted before each line of the output
- `stdin` if set will be written to the child process's stdin
- `next(err, stdout, stderr, code, signal)`
- `spawnMultiple(commands, opts?, next?)` spawn multiple processes, forwards on to `require('safeps').spawn`
Expand Down Expand Up @@ -164,6 +168,7 @@ No sponsors yet! Will you be the first?
[![Gittip donate button](http://img.shields.io/gittip/bevry.png)](https://www.gittip.com/bevry/ "Donate weekly to this project using Gittip")
[![Flattr donate button](http://img.shields.io/flattr/donate.png?color=yellow)](http://flattr.com/thing/344188/balupton-on-Flattr "Donate monthly to this project using Flattr")
[![PayPayl donate button](http://img.shields.io/paypal/donate.png?color=yellow)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=QB8GQPZAH84N6 "Donate once-off to this project using Paypal")
[![BitCoin donate button](http://img.shields.io/bitcoin/donate.png?color=yellow)](https://coinbase.com/checkouts/9ef59f5479eec1d97d63382c9ebcb93a "Donate once-off to this project using BitCoin")

### Contributors

Expand Down
11 changes: 7 additions & 4 deletions package.json
@@ -1,7 +1,7 @@
{
"title": "Safe PS",
"name": "safeps",
"version": "2.2.10",
"version": "2.2.11",
"description": "Work with processes safely and easily with Node.js",
"homepage": "https://github.com/bevry/safeps",
"license": {
Expand All @@ -10,9 +10,12 @@
"badges": {
"travis": true,
"npm": true,
"david": true,
"daviddev": true,
"gittip": "bevry",
"flattr": "344188/balupton-on-Flattr",
"paypal": "QB8GQPZAH84N6"
"paypal": "QB8GQPZAH84N6",
"bitcoin": "https://coinbase.com/checkouts/9ef59f5479eec1d97d63382c9ebcb93a"
},
"keywords": [
"ps",
Expand Down Expand Up @@ -45,15 +48,15 @@
"dependencies": {
"typechecker": "~2.0.8",
"safefs": "~3.1.0",
"taskgroup": "~3.3.1",
"taskgroup": "~3.3.6",
"extract-opts": "~2.2.0"
},
"devDependencies": {
"coffee-script": "~1.6.2",
"joe": "~1.3.0",
"joe-reporter-console": "~1.2.1",
"chai": "~1.8.1",
"projectz": "~0.3.2"
"projectz": "~0.3.5"
},
"directories": {
"lib": "./out/lib"
Expand Down
8 changes: 6 additions & 2 deletions src/lib/safeps.coffee
Expand Up @@ -144,10 +144,14 @@ safeps =
# Listen
# Streams may be null if stdio is 'inherit'
pid.stdout?.on 'data', (data) ->
process.stdout.write(data) if opts.output
if opts.output
data = opts.outputPrefix+data.toString().trim().replace(/\n/g, '\n'+opts.outputPrefix)+'\n' if opts.outputPrefix
process.stdout.write(data)
stdout += data.toString()
pid.stderr?.on 'data', (data) ->
process.stderr.write(data) if opts.output
if opts.output
data = opts.outputPrefix+data.toString().trim().replace(/\n/g, '\n'+opts.outputPrefix)+'\n' if opts.outputPrefix
process.stderr.write(data)
stderr += data.toString()

# Wait
Expand Down

0 comments on commit 7eb2523

Please sign in to comment.