Fix crash when vim editor is not found in PATH on Windows

Fixes #16492

This patch checks if the editor command exists before calling spawnSync.
Without this check, Node throws ENOENT when vim is not in PATH on Windows.
This commit is contained in:
Tommaso Sciortino
2026-04-02 10:18:13 -07:00
parent beff8c91aa
commit 6f3740bc3b
+4
View File
@@ -302,6 +302,10 @@ export async function openDiff(
if (isTerminalEditor(editor)) {
try {
if (!commandExists(diffCommand.command)) {
throw new Error(`Editor command not found: ${diffCommand.command}`);
}
const result = spawnSync(diffCommand.command, diffCommand.args, {
stdio: 'inherit',
});