Skip to content

Commit

Permalink
ensures these commands run detached from the parent process
Browse files Browse the repository at this point in the history
  • Loading branch information
leeliu committed Nov 23, 2016
1 parent d5e3d39 commit d2783ce
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/connection-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ function updateSelf() {
// update self
return spawn('/bin/bash', ['-c',
'if [[ ! -z $(which apt-get) ]]; then apt-get update; apt-get install -y --force-yes logdna-agent; elif [[ ! -z $(which yum) ]]; then yum clean expire-cache; yum -y install logdna-agent; elif [[ ! -z $(which zypper) ]]; then zypper refresh; zypper install -y logdna-agent; fi; sleep 1; /etc/init.d/logdna-agent start'
]);
], {
detached: true
});
} else {
// update self
return spawn('cmd.exe', ['/c', 'choco', 'upgrade', 'logdna-agent', '-y', '--allowunofficial'],
Expand All @@ -32,7 +34,9 @@ function restartSelf() {
// restart self
return spawn('/bin/bash', ['-c',
'/etc/init.d/logdna-agent restart'
]);
], {
detached: true
});
} else if (os.platform() === 'win32') {
// restart self
return spawn('cmd.exe', ['/c',
Expand Down

0 comments on commit d2783ce

Please sign in to comment.