mirror of
https://github.com/everoddandeven/monerod-gui.git
synced 2024-12-22 19:49:27 +00:00
Fix linux path discrimination and uncaught exeception in main process for monerod processes #7
This commit is contained in:
parent
f3218ea17e
commit
78cb7f2867
2 changed files with 22 additions and 5 deletions
20
app/main.ts
20
app/main.ts
|
@ -402,19 +402,28 @@ function isWifiConnected() {
|
||||||
function getMonerodVersion(monerodFilePath: string): void {
|
function getMonerodVersion(monerodFilePath: string): void {
|
||||||
const monerodProcess = spawn(monerodFilePath, [ '--version' ]);
|
const monerodProcess = spawn(monerodFilePath, [ '--version' ]);
|
||||||
|
|
||||||
|
monerodProcess.on('error', (err: Error) => {
|
||||||
|
win?.webContents.send('monero-version-error', `${err.message}`);
|
||||||
|
});
|
||||||
|
|
||||||
monerodProcess.stdout.on('data', (data) => {
|
monerodProcess.stdout.on('data', (data) => {
|
||||||
win?.webContents.send('monero-version', `${data}`);
|
win?.webContents.send('monero-version', `${data}`);
|
||||||
})
|
});
|
||||||
|
|
||||||
monerodProcess.stderr.on('data', (data) => {
|
monerodProcess.stderr.on('data', (data) => {
|
||||||
win?.webContents.send('monero-version-error', `${data}`);
|
win?.webContents.send('monero-version-error', `${data}`);
|
||||||
})
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkValidMonerodPath(monerodPath: string): void {
|
function checkValidMonerodPath(monerodPath: string): void {
|
||||||
let foundUsage: boolean = false;
|
let foundUsage: boolean = false;
|
||||||
const monerodProcess = spawn(monerodPath, ['--help']);
|
const monerodProcess = spawn(monerodPath, ['--help']);
|
||||||
|
|
||||||
|
monerodProcess.on('error', (err: Error) => {
|
||||||
|
win?.webContents.send('on-check-valid-monerod-path', false);
|
||||||
|
});
|
||||||
|
|
||||||
monerodProcess.stderr.on('data', (data) => {
|
monerodProcess.stderr.on('data', (data) => {
|
||||||
win?.webContents.send('on-check-valid-monerod-path', false);
|
win?.webContents.send('on-check-valid-monerod-path', false);
|
||||||
});
|
});
|
||||||
|
@ -427,7 +436,7 @@ function checkValidMonerodPath(monerodPath: string): void {
|
||||||
|
|
||||||
monerodProcess.on('close', (code: number) => {
|
monerodProcess.on('close', (code: number) => {
|
||||||
win?.webContents.send('on-check-valid-monerod-path', foundUsage);
|
win?.webContents.send('on-check-valid-monerod-path', foundUsage);
|
||||||
})
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -486,6 +495,11 @@ function startMoneroDaemon(commandOptions: string[]): ChildProcessWithoutNullStr
|
||||||
});
|
});
|
||||||
|
|
||||||
// Gestisci la chiusura del processo
|
// Gestisci la chiusura del processo
|
||||||
|
|
||||||
|
monerodProcess.on('error', (err: Error) => {
|
||||||
|
win?.webContents.send('monero-stderr', `${err.message}`);
|
||||||
|
});
|
||||||
|
|
||||||
monerodProcess.on('close', (code: number) => {
|
monerodProcess.on('close', (code: number) => {
|
||||||
console.log(`monerod exited with code: ${code}`);
|
console.log(`monerod exited with code: ${code}`);
|
||||||
win?.webContents.send('monero-stdout', `monerod exited with code: ${code}`);
|
win?.webContents.send('monero-stdout', `monerod exited with code: ${code}`);
|
||||||
|
|
|
@ -1145,8 +1145,11 @@ export class DaemonService {
|
||||||
const destination = settings.downloadUpgradePath; // Aggiorna con il percorso desiderato
|
const destination = settings.downloadUpgradePath; // Aggiorna con il percorso desiderato
|
||||||
const moneroFolder = await this.installer.downloadMonero(destination, settings.monerodPath != '');
|
const moneroFolder = await this.installer.downloadMonero(destination, settings.monerodPath != '');
|
||||||
const { platform } = await this.electronService.getOsType();
|
const { platform } = await this.electronService.getOsType();
|
||||||
const ext = platform == 'win32' ? '.exe' : '';
|
const isWin32 = platform == 'win32';
|
||||||
const separator = platform ?? 'win32' ? '\\' : '/';
|
|
||||||
|
const ext = isWin32 ? '.exe' : '';
|
||||||
|
const separator = isWin32 ? '\\' : '/';
|
||||||
|
|
||||||
settings.monerodPath = `${moneroFolder}${separator}monerod${ext}`;
|
settings.monerodPath = `${moneroFolder}${separator}monerod${ext}`;
|
||||||
|
|
||||||
await this.saveSettings(settings);
|
await this.saveSettings(settings);
|
||||||
|
|
Loading…
Reference in a new issue