From 840fc65ffcea4a50c76db23c89cf3a7492e77122 Mon Sep 17 00:00:00 2001 From: Shawn Date: Fri, 15 Mar 2019 22:06:53 -0500 Subject: [PATCH 1/3] Fix lbrynet not starting --- src/platforms/electron/Daemon.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/platforms/electron/Daemon.js b/src/platforms/electron/Daemon.js index 43e0573d9..979bc5a1f 100644 --- a/src/platforms/electron/Daemon.js +++ b/src/platforms/electron/Daemon.js @@ -4,7 +4,7 @@ import { spawn, execSync } from 'child_process'; import { Lbry } from 'lbry-redux'; export default class Daemon { - static path = process.env.LBRY_DAEMON || path.join(__static, 'lbrynet'); + static path = process.env.LBRY_DAEMON || path.join(process.resourcesPath, 'static', 'lbrynet'); subprocess; handlers; From de51d8fc191366d36d4b8e5a12056cd3d217956b Mon Sep 17 00:00:00 2001 From: Shawn Date: Fri, 15 Mar 2019 22:44:02 -0500 Subject: [PATCH 2/3] Fix daemon not spawning in dev mode --- package.json | 3 +-- src/platforms/electron/Daemon.js | 4 +++- webpack.electron.config.js | 5 ++++- yarn.lock | 2 +- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 763ab4cdc..40b2f83dd 100644 --- a/package.json +++ b/package.json @@ -45,7 +45,7 @@ "electron-log": "^2.2.12", "electron-updater": "^4.0.6", "express": "^4.16.4", - "keytar": "4.4.1" + "keytar": "^4.4.1" }, "devDependencies": { "@babel/core": "^7.0.0", @@ -100,7 +100,6 @@ "hast-util-sanitize": "^1.1.2", "husky": "^0.14.3", "json-loader": "^0.5.4", - "keytar": "4.4.1", "lbry-format": "https://github.com/lbryio/lbry-format.git", "lbry-redux": "lbryio/lbry-redux#2a7e05940f892f104428eeb37bd1f178da811a09", "lbryinc": "lbryio/lbryinc#351d0a08806b0f770b50066b61a806171f6424d4", diff --git a/src/platforms/electron/Daemon.js b/src/platforms/electron/Daemon.js index 979bc5a1f..223015ff7 100644 --- a/src/platforms/electron/Daemon.js +++ b/src/platforms/electron/Daemon.js @@ -4,7 +4,9 @@ import { spawn, execSync } from 'child_process'; import { Lbry } from 'lbry-redux'; export default class Daemon { - static path = process.env.LBRY_DAEMON || path.join(process.resourcesPath, 'static', 'lbrynet'); + static path = process.env.LBRY_DAEMON || ( + process.env.NODE_ENV === 'production' ? path.join(process.resourcesPath, 'static', 'lbrynet') : path.join(__static, 'lbrynet') + ); subprocess; handlers; diff --git a/webpack.electron.config.js b/webpack.electron.config.js index 9a346022f..4f32cc0da 100644 --- a/webpack.electron.config.js +++ b/webpack.electron.config.js @@ -60,7 +60,10 @@ if (process.env.NODE_ENV === 'production') { const nodeExternals = require('webpack-node-externals'); // Apply dev overrides mainConfig = merge(mainConfig, { - externals: [nodeExternals()], + externals: { + keytar: 'require("keytar")', + electron: 'require("electron")', + }, }); } diff --git a/yarn.lock b/yarn.lock index b8892cfad..ad9f9f43f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5982,7 +5982,7 @@ kebab-case@^1.0.0: resolved "https://registry.yarnpkg.com/kebab-case/-/kebab-case-1.0.0.tgz#3f9e4990adcad0c686c0e701f7645868f75f91eb" integrity sha1-P55JkK3K0MaGwOcB92RYaPdfkes= -keytar@4.4.1: +keytar@^4.4.1: version "4.4.1" resolved "https://registry.yarnpkg.com/keytar/-/keytar-4.4.1.tgz#156af8a9b016bf118ee9948b02418c81d760a5ba" integrity sha512-6xEe7ybXSR5EZC+z0GI2yqLYZjV1tyPQY2xSZ8rGsBxrrLEh8VR/Lfqv59uGX+I+W+OZxH0jCXN1dU1++ify4g== From 0f2ffa696d6780ae6ba6755e7c2723a9fe9f6366 Mon Sep 17 00:00:00 2001 From: Shawn Date: Fri, 15 Mar 2019 22:55:01 -0500 Subject: [PATCH 3/3] Add SIGINT to devServer threads on exit --- src/platforms/electron/devServer.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/platforms/electron/devServer.js b/src/platforms/electron/devServer.js index f86b4585e..bd87c3ca0 100644 --- a/src/platforms/electron/devServer.js +++ b/src/platforms/electron/devServer.js @@ -70,4 +70,11 @@ mainInstance.waitUntilValid(() => { child.stdout.on('data', (data) => { console.log(data.toString()); }); + + process.on('SIGINT', function() { + console.log('Killing threads...'); + + child.kill('SIGINT'); + process.exit(); + }); });