Skip to content

Commit

Permalink
[docs] Update docs to indicate that the pid is now returned.
Browse files Browse the repository at this point in the history
  • Loading branch information
AvianFlu committed May 17, 2012
1 parent 4201dba commit 744a7c7
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions README.md
Expand Up @@ -58,13 +58,15 @@ application logic starts.
var http = require('http'),
prefork = require('prefork');

prefork();
var pid = prefork();

http.createServer(function (req, res) {
res.end('I am a backgrounded HTTP server.');
res.end('I am a backgrounded HTTP server, running as ' + pid);
}).listen(8080);

```
`prefork()` will perform all necessary actions to background your process, and
return the new `pid`.

### stdio redirection

Expand All @@ -74,10 +76,12 @@ To simply log all output to a file:

```js

prefork({
var pid = prefork({
stdout: 'output.log'
});

console.log('Started successfully, new pid is %d', pid);

```

If only `stdout` is provided, `stderr` will be redirected to the same place.
Expand Down

0 comments on commit 744a7c7

Please sign in to comment.