Skip to content

Commit

Permalink
Merge pull request #16 from asafyish/master
Browse files Browse the repository at this point in the history
Decrease count when electron crashes
  • Loading branch information
FWeinb committed Feb 24, 2016
2 parents a891483 + 784af11 commit 3cf6dc6
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,6 @@ var electronpath = require('electron-prebuilt');
var app = path.join(__dirname, '../', 'electron-service');
var sock = axon.socket('req');

var startElectron = function () {
spawn(electronpath, ['.'], {
cwd: app
});
};

var bindSocketPromise;
var bindSocket = function () {
if (bindSocketPromise) {
Expand Down Expand Up @@ -78,10 +72,16 @@ module.exports = {
},

createBrowser: function () {
var self = this;
this.count++;
return bindSocket()
.then(function () {
startElectron();
spawn(electronpath, ['.'], {
cwd: app
})
.once('close', function() {
self.count--;
});
});
},

Expand Down

0 comments on commit 3cf6dc6

Please sign in to comment.