Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

add chdir back

  • Loading branch information...
commit c180a8303edde86e34eab0ec534f3818fd58c423 1 parent ec2d9ad
@chjj authored
Showing with 13 additions and 7 deletions.
  1. +13 −7 lib/daemonic.js
View
20 lib/daemonic.js
@@ -122,6 +122,11 @@ function fork(argv, opt) {
, code = ''
, ps;
+ // chdir
+ opt.cd = opt.cd || opt.chdir
+ ? 'cd / && '
+ : '';
+
// umask
opt.umask = opt.umask
? 'umask 0 && '
@@ -143,17 +148,18 @@ function fork(argv, opt) {
}
opt.stdin = opt.stdin != null
- ? ' 0 <& ' + opt.stdin
- : ' 0 < /dev/null';
+ ? ' 0<& ' + opt.stdin
+ : ' 0< /dev/null';
opt.stdout = opt.stdout != null
- ? ' 1 >& ' + opt.stdout
- : ' 1 > /dev/null';
+ ? ' 1>& ' + opt.stdout
+ : ' 1> /dev/null';
opt.stderr = opt.stderr != null
- ? ' 2 >& ' + opt.stderr
- : ' 2 > /dev/null';
+ ? ' 2>& ' + opt.stderr
+ : ' 2> /dev/null';
// sh
code = '('
+ + opt.cd
+ opt.umask
+ opt.setsid
+ argv
@@ -166,7 +172,7 @@ function fork(argv, opt) {
ps = spawn('/bin/sh', [ '-c', code ], {
setsid: false,
customFds: [-1, -1, -1],
- cwd: opt.cwd || (opt.cd || opt.chdir ? '/' : process.cwd()),
+ cwd: opt.cwd || process.cwd(),
env: opt.env || process.env
});
Please sign in to comment.
Something went wrong with that request. Please try again.