Skip to content

Commit

Permalink
kill child process of spawned child processes - fix #44 (#46)
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanjudis authored Jul 27, 2016
1 parent 3abb88e commit e450ba6
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"electron-settings": "^1.0.4",
"electron-window-state": "^3.0.3",
"fix-path": "^2.0.0",
"ps-tree": "^1.1.0",
"vue": "^1.0.24",
"vue-electron": "^1.0.0",
"vue-router": "^0.7.13",
Expand Down
7 changes: 6 additions & 1 deletion app/src/components/RepoView/CommandOutput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@
data() {
return {
exec : this.$electron.remote.require( 'child_process' ).exec,
psTree : this.$electron.remote.require( 'ps-tree' ),
process : null,
processStatus : null,
processCmd : null,
Expand Down Expand Up @@ -185,7 +186,11 @@
killScript() {
if ( this.process ) {
this.process.kill( 'SIGTERM' );
// make sure also child processes
// of child processes get killed
this.psTree( this.process.pid, ( err, children ) => {
this.exec( `kill -9 ${ children.map( p => p.PID ).join( ' ' ) }` );
} );
}
},
Expand Down
2 changes: 1 addition & 1 deletion config.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const config = {
vueDevTools : false,
build : {
'app-version' : pkg.version,
packagesToBeIncluded : [ 'fix-path', 'electron-window-state' ],
packagesToBeIncluded : [ 'fix-path', 'electron-window-state', 'ps-tree' ],
overwrite : true,
asar : true,
dmg : {
Expand Down

0 comments on commit e450ba6

Please sign in to comment.