summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorLinus Färnstrand <linus@mullvad.net>2018-05-14 16:01:37 +0200
committerLinus Färnstrand <linus@mullvad.net>2018-05-14 16:23:38 +0200
commite7221ad616a02f86a24687249aa405e40de469a5 (patch)
treed1db98dbf1ccc4ba907d1bcc87faba72f18cd665
parent2ed55b41ec3a6c60a2da84a38b9fb610069b13be (diff)
downloadmullvadvpn-e7221ad616a02f86a24687249aa405e40de469a5.tar.xz
mullvadvpn-e7221ad616a02f86a24687249aa405e40de469a5.zip
Remove startBackend code from GUI app
-rw-r--r--app/main.js59
-rw-r--r--package.json2
-rw-r--r--yarn.lock13
3 files changed, 1 insertions, 73 deletions
diff --git a/app/main.js b/app/main.js
index ea85de8b36..863d8a6f67 100644
--- a/app/main.js
+++ b/app/main.js
@@ -5,8 +5,6 @@ import mkdirp from 'mkdirp';
import { log } from './lib/platform';
import electron, { app, BrowserWindow, ipcMain, Tray, Menu, nativeImage } from 'electron';
import TrayIconManager from './lib/tray-icon-manager';
-import ElectronSudo from 'electron-sudo';
-import shellescape from 'shell-escape';
import { version } from '../package.json';
import { parseIpcCredentials } from './lib/backend';
import { resolveBin } from './lib/proc';
@@ -41,12 +39,6 @@ const appDelegate = {
log.info('Running version', version);
- // Only macOS builds still launch the daemon manually.
- // On other platforms mullvad-daemon already runs as a system service.
- if (process.platform === 'darwin') {
- appDelegate._startBackend();
- }
-
app.on('window-all-closed', () => appDelegate.onAllWindowsClosed());
app.on('ready', () => appDelegate.onReady());
},
@@ -188,33 +180,6 @@ const appDelegate = {
onAllWindowsClosed: () => {
app.quit();
},
-
- _startBackend: () => {
- const rpcAddressFile = appDelegate._getRpcAddressFilePath();
- const backendIsRunning = fs.existsSync(rpcAddressFile);
- if (backendIsRunning) {
- log.info('Not starting the backend as it appears to already be running');
- return;
- }
-
- const pathToBackend = resolveBin('mullvad-daemon');
- log.info('Starting the mullvad backend at', pathToBackend);
-
- const options = {
- name: 'Mullvad',
- };
- const sudo = new ElectronSudo(options);
- const backendCommand = shellescape([
- pathToBackend, '-v',
- '--log', path.join(appDelegate._logFileLocation, 'backend.log'),
- '--tunnel-log', path.join(appDelegate._logFileLocation, 'openvpn.log')
- ]);
- sudo.spawn(backendCommand, [])
- .then( p => {
- appDelegate._setupBackendProcessListeners(p);
- return p;
- });
- },
_getRpcAddressFilePath: () => {
const rpcAddressFileName = '.mullvad_rpc_address';
@@ -225,30 +190,6 @@ const appDelegate = {
return path.join(getSystemTemporaryDirectory(), rpcAddressFileName);
}
},
- _setupBackendProcessListeners: (p) => {
- // electron-sudo writes all output to some buffers in memory.
- // For long-running processes such as this one that would
- // cause a memory leak.
- p.stdout.removeAllListeners('data');
- p.stderr.removeAllListeners('data');
-
- p.stdout.on('data', (data) => {
- console.log('BACKEND stdout:', data.toString());
- });
- p.stderr.on('data', (data) => {
- console.warn('BACKEND stderr:', data.toString());
- });
-
- p.on('error', (err) => {
- log.error('Failed to start or kill the backend', err);
- });
-
- p.on('exit', (code) => {
- const timeoutMs = 500;
- log.info('The backend exited with code', code + '. Attempting to restart it in', timeoutMs, 'milliseconds...');
- setTimeout( () => appDelegate._startBackend(), timeoutMs);
- });
- },
_pollForConnectionInfoFile: () => {
if (appDelegate.connectionFilePollInterval) {
diff --git a/package.json b/package.json
index b7d77d582b..bb794f5fe9 100644
--- a/package.json
+++ b/package.json
@@ -14,7 +14,6 @@
"babel-runtime": "^6.22.0",
"d3-geo-projection": "^2.3.2",
"electron-log": "^2.2.8",
- "electron-sudo": "https://github.com/mullvad/electron-sudo.git",
"history": "^4.6.1",
"jsonrpc-lite": "^1.2.3",
"mkdirp": "^0.5.1",
@@ -31,7 +30,6 @@
"reactxp": "^1.1.0-rc.2",
"redux": "^3.0.0",
"redux-thunk": "^2.2.0",
- "shell-escape": "^0.2.0",
"uuid": "^3.0.1",
"validated": "^1.1.0"
},
diff --git a/yarn.lock b/yarn.lock
index 223260621a..f107aa71d5 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -1396,7 +1396,7 @@ bluebird-lst@^1.0.5:
dependencies:
bluebird "^3.5.1"
-bluebird@^3.4.6, bluebird@^3.5.0, bluebird@^3.5.1:
+bluebird@^3.5.0, bluebird@^3.5.1:
version "3.5.1"
resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.5.1.tgz#d9551f9de98f1fcda1e683d17ee91a0602ee2eb9"
@@ -2786,13 +2786,6 @@ electron-publish@19.55.2:
fs-extra-p "^4.5.0"
mime "^2.2.0"
-"electron-sudo@https://github.com/mullvad/electron-sudo.git":
- version "4.0.12"
- resolved "https://github.com/mullvad/electron-sudo.git#f71134f86541b15359f4813715d721818fb2b1f4"
- dependencies:
- babel-runtime "^6.18.0"
- bluebird "^3.4.6"
-
electron-window@^0.8.0:
version "0.8.1"
resolved "https://registry.yarnpkg.com/electron-window/-/electron-window-0.8.1.tgz#16ca187eb4870b0679274fc8299c5960e6ab2c5e"
@@ -7000,10 +6993,6 @@ shebang-regex@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-1.0.0.tgz#da42f49740c0b42db2ca9728571cb190c98efea3"
-shell-escape@^0.2.0:
- version "0.2.0"
- resolved "https://registry.yarnpkg.com/shell-escape/-/shell-escape-0.2.0.tgz#68fd025eb0490b4f567a027f0bf22480b5f84133"
-
shell-quote@1.6.1, shell-quote@^1.6.1:
version "1.6.1"
resolved "https://registry.yarnpkg.com/shell-quote/-/shell-quote-1.6.1.tgz#f4781949cce402697127430ea3b3c5476f481767"