fix: daemon not killed when migrating app architecture (#1109)
Add an option to kill running daemon when it's incompatible with the app version.
This commit is contained in:
parent
98d7332399
commit
7f7f09c206
3 changed files with 26 additions and 9 deletions
|
@ -1,12 +1,10 @@
|
||||||
import React from 'react';
|
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { doQuit, doSkipWrongDaemonNotice } from 'redux/actions/app';
|
import { doQuit, doQuitAnyDaemon } from 'redux/actions/app';
|
||||||
import ModalIncompatibleDaemon from './view';
|
import ModalIncompatibleDaemon from './view';
|
||||||
|
|
||||||
const select = state => ({});
|
|
||||||
|
|
||||||
const perform = dispatch => ({
|
const perform = dispatch => ({
|
||||||
quit: () => dispatch(doQuit()),
|
quit: () => dispatch(doQuit()),
|
||||||
|
quitAnyDaemon: () => dispatch(doQuitAnyDaemon()),
|
||||||
});
|
});
|
||||||
|
|
||||||
export default connect(select, perform)(ModalIncompatibleDaemon);
|
export default connect(null, perform)(ModalIncompatibleDaemon);
|
||||||
|
|
|
@ -4,15 +4,17 @@ import Link from 'component/link/index';
|
||||||
|
|
||||||
class ModalIncompatibleDaemon extends React.PureComponent {
|
class ModalIncompatibleDaemon extends React.PureComponent {
|
||||||
render() {
|
render() {
|
||||||
const { quit } = this.props;
|
const { quit, quitAnyDaemon } = this.props;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Modal
|
<Modal
|
||||||
isOpen
|
isOpen
|
||||||
contentLabel={__('Incompatible daemon running')}
|
contentLabel={__('Incompatible daemon running')}
|
||||||
type="alert"
|
type="confirm"
|
||||||
confirmButtonLabel={__('Quit')}
|
confirmButtonLabel={__('Quit daemon')}
|
||||||
onConfirmed={quit}
|
abortButtonLabel={__('Do nothing')}
|
||||||
|
onConfirmed={quitAnyDaemon}
|
||||||
|
onAborted={quit}
|
||||||
>
|
>
|
||||||
{__(
|
{__(
|
||||||
'This browser is running with an incompatible version of the LBRY protocol and your install must be repaired. '
|
'This browser is running with an incompatible version of the LBRY protocol and your install must be repaired. '
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { execSync } from 'child_process';
|
||||||
import isDev from 'electron-is-dev';
|
import isDev from 'electron-is-dev';
|
||||||
import Lbry from 'lbry';
|
import Lbry from 'lbry';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
|
@ -329,6 +330,22 @@ export function doQuit() {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function doQuitAnyDaemon() {
|
||||||
|
return dispatch => {
|
||||||
|
try {
|
||||||
|
if (process.platform === 'win32') {
|
||||||
|
execSync('taskkill /im lbrynet-daemon.exe /t /f');
|
||||||
|
} else {
|
||||||
|
execSync('pkill lbrynet-daemon');
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
dispatch(doAlertError(`Quitting daemon failed due to: ${error.message}`));
|
||||||
|
} finally {
|
||||||
|
dispatch(doQuit());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
export function doChangeVolume(volume) {
|
export function doChangeVolume(volume) {
|
||||||
return dispatch => {
|
return dispatch => {
|
||||||
dispatch({
|
dispatch({
|
||||||
|
|
Loading…
Add table
Reference in a new issue