mirror of
https://github.com/PR0M3TH3AN/VoxVera.git
synced 2025-09-08 06:58:42 +00:00
Merge pull request #40 from PR0M3TH3AN/codex/fix-spawn-enoent-error-in-electron-app
Improve Electron GUI error handling
This commit is contained in:
@@ -15,3 +15,6 @@ This page collects common issues encountered when hosting or accessing flyers.
|
||||
- Run `sudo chcon -Rt svirt_sandbox_file_t host` or disable SELinux enforcement for the folder.
|
||||
|
||||
If problems persist, consult the OnionShare and Tor documentation for more advanced configuration tips.
|
||||
|
||||
## Electron GUI
|
||||
If `npm start` fails with `spawn voxvera ENOENT`, the `voxvera` command is not in your `PATH`. Install it with `pipx install voxvera` or run `./install.sh` from the repository.
|
||||
|
@@ -1,6 +1,7 @@
|
||||
const { app, BrowserWindow, ipcMain } = require('electron');
|
||||
const { app, BrowserWindow, ipcMain, dialog } = require('electron');
|
||||
const { spawn } = require('child_process');
|
||||
const path = require('path');
|
||||
const which = require('which');
|
||||
|
||||
function createWindow() {
|
||||
const win = new BrowserWindow({
|
||||
@@ -16,8 +17,16 @@ function createWindow() {
|
||||
app.whenReady().then(createWindow);
|
||||
|
||||
ipcMain.handle('run-quickstart', async () => {
|
||||
const voxveraPath = which.sync('voxvera', { nothrow: true });
|
||||
if (!voxveraPath) {
|
||||
dialog.showErrorBox(
|
||||
'voxvera not found',
|
||||
'Install the voxvera CLI and ensure it is in your PATH.'
|
||||
);
|
||||
return -1;
|
||||
}
|
||||
return new Promise((resolve, reject) => {
|
||||
const proc = spawn('voxvera', ['quickstart'], { stdio: 'inherit' });
|
||||
const proc = spawn(voxveraPath, ['quickstart'], { stdio: 'inherit' });
|
||||
proc.on('close', code => resolve(code));
|
||||
proc.on('error', err => reject(err));
|
||||
});
|
||||
|
@@ -6,6 +6,7 @@
|
||||
"start": "electron ."
|
||||
},
|
||||
"devDependencies": {
|
||||
"electron": "^29.0.0"
|
||||
"electron": "^29.0.0",
|
||||
"which": "^3.0.0"
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user