Skip to content

Voice-to-text dictation app with local (Nvidia Parakeet/Whisper) and cloud models (BYOK). Privacy-first and available cross-platform.

fic: fix missing catch block in pythonInstaller.js

Gabriel Steine875bc66b87d
diff --git a/src/helpers/clipboard.js b/src/helpers/clipboard.js
index 915d09ff7..f1138509e 100644
--- a/src/helpers/clipboard.js
+++ b/src/helpers/clipboard.js
@@ -130,12 +130,17 @@ class ClipboardManager {
async pasteWindows(originalClipboard) {
return new Promise((resolve, reject) => {
+ let hasTimedOut = false;
+
const pasteProcess = spawn("powershell", [
"-Command",
'Add-Type -AssemblyName System.Windows.Forms; [System.Windows.Forms.SendKeys]::SendWait("^v")',
]);
pasteProcess.on("close", (code) => {
+ if (hasTimedOut) return;
+ clearTimeout(timeoutId);
+
if (code === 0) {
// Text pasted successfully
setTimeout(() => {
@@ -145,19 +150,32 @@ class ClipboardManager {
} else {
reject(
new Error(
- `Windows paste failed with code ${code}. Text is copied to clipboard.`
+ `Windows paste failed with code ${code}. Text is copied to clipboard - please paste manually with Ctrl+V.`
)
);
}
});
pasteProcess.on("error", (error) => {
+ if (hasTimedOut) return;
+ clearTimeout(timeoutId);
reject(
new Error(
- `Windows paste failed: ${error.message}. Text is copied to clipboard.`
+ `Windows paste failed: ${error.message}. Text is copied to clipboard - please paste manually with Ctrl+V.`
)
);
});
+
+ const timeoutId = setTimeout(() => {
+ hasTimedOut = true;
+ killProcess(pasteProcess, 'SIGKILL');
+ pasteProcess.removeAllListeners();
+ reject(
+ new Error(
+ "Paste operation timed out. Text is copied to clipboard - please paste manually with Ctrl+V."
+ )
+ );
+ }, 3000);
});
}
diff --git a/src/helpers/pythonInstaller.js b/src/helpers/pythonInstaller.js
index 5e1ab90dc..1d6fda568 100644
--- a/src/helpers/pythonInstaller.js
+++ b/src/helpers/pythonInstaller.js
@@ -284,6 +284,8 @@ class PythonInstaller {
}
}
}
+ } catch (error) {
+ throw new Error(`Linux Python installation failed: ${error.message}`);
}
}
diff --git a/whisper_bridge.py b/whisper_bridge.py
index e2d9205fe..f846f4047 100755
--- a/whisper_bridge.py
+++ b/whisper_bridge.py
@@ -28,7 +28,7 @@ def get_whisper_cache_dir():
return os.path.join(user_profile, ".cache", "whisper")
else:
# macOS/Linux: use ~/.cache/whisper
- return get_whisper_cache_dir()
+ return os.path.expanduser("~/.cache/whisper")
def get_ffmpeg_path():
"""Get path to bundled FFmpeg executable with proper production support"""
@@ -40,8 +40,10 @@ def get_ffmpeg_path():
]
for env_name, env_path in env_paths:
- if env_path and os.path.exists(env_path) and os.access(env_path, os.X_OK):
- return env_path
+ # On Windows, skip X_OK check since it doesn't use Unix-style execute permissions
+ if env_path and os.path.exists(env_path):
+ if sys.platform == "win32" or os.access(env_path, os.X_OK):
+ return env_path
# Determine base path
if getattr(sys, 'frozen', False):
@@ -80,8 +82,10 @@ def get_ffmpeg_path():
# Try each possible path
for ffmpeg_path in possible_paths:
abs_path = os.path.abspath(ffmpeg_path)
- if os.path.exists(abs_path) and os.access(abs_path, os.X_OK):
- return abs_path
+ # On Windows, skip X_OK check since it doesn't use Unix-style execute permissions
+ if os.path.exists(abs_path):
+ if sys.platform == "win32" or os.access(abs_path, os.X_OK):
+ return abs_path
# Try system FFmpeg as last resort
if sys.platform == "darwin":