diff --git a/app/main.ts b/app/main.ts index e57aba9..f658483 100644 --- a/app/main.ts +++ b/app/main.ts @@ -402,19 +402,28 @@ function isWifiConnected() { function getMonerodVersion(monerodFilePath: string): void { const monerodProcess = spawn(monerodFilePath, [ '--version' ]); + monerodProcess.on('error', (err: Error) => { + win?.webContents.send('monero-version-error', `${err.message}`); + }); + monerodProcess.stdout.on('data', (data) => { win?.webContents.send('monero-version', `${data}`); - }) + }); monerodProcess.stderr.on('data', (data) => { win?.webContents.send('monero-version-error', `${data}`); - }) + }); + } function checkValidMonerodPath(monerodPath: string): void { let foundUsage: boolean = false; const monerodProcess = spawn(monerodPath, ['--help']); + monerodProcess.on('error', (err: Error) => { + win?.webContents.send('on-check-valid-monerod-path', false); + }); + monerodProcess.stderr.on('data', (data) => { win?.webContents.send('on-check-valid-monerod-path', false); }); @@ -427,7 +436,7 @@ function checkValidMonerodPath(monerodPath: string): void { monerodProcess.on('close', (code: number) => { win?.webContents.send('on-check-valid-monerod-path', foundUsage); - }) + }); } @@ -486,6 +495,11 @@ function startMoneroDaemon(commandOptions: string[]): ChildProcessWithoutNullStr }); // Gestisci la chiusura del processo + + monerodProcess.on('error', (err: Error) => { + win?.webContents.send('monero-stderr', `${err.message}`); + }); + monerodProcess.on('close', (code: number) => { console.log(`monerod exited with code: ${code}`); win?.webContents.send('monero-stdout', `monerod exited with code: ${code}`); diff --git a/src/app/core/services/daemon/daemon.service.ts b/src/app/core/services/daemon/daemon.service.ts index 66b0f23..7e81b2a 100644 --- a/src/app/core/services/daemon/daemon.service.ts +++ b/src/app/core/services/daemon/daemon.service.ts @@ -1145,8 +1145,11 @@ export class DaemonService { const destination = settings.downloadUpgradePath; // Aggiorna con il percorso desiderato const moneroFolder = await this.installer.downloadMonero(destination, settings.monerodPath != ''); const { platform } = await this.electronService.getOsType(); - const ext = platform == 'win32' ? '.exe' : ''; - const separator = platform ?? 'win32' ? '\\' : '/'; + const isWin32 = platform == 'win32'; + + const ext = isWin32 ? '.exe' : ''; + const separator = isWin32 ? '\\' : '/'; + settings.monerodPath = `${moneroFolder}${separator}monerod${ext}`; await this.saveSettings(settings);