From 1745a25cb8f00e211a9bbc05888fcaba29d3aa2f Mon Sep 17 00:00:00 2001 From: rhysd Date: Sun, 28 Jul 2024 23:04:31 +0900 Subject: [PATCH] fix `vim` command hangs on Windows --- src/vim.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/vim.ts b/src/vim.ts index 757af0e..6215dd8 100644 --- a/src/vim.ts +++ b/src/vim.ts @@ -198,8 +198,18 @@ export async function installVimOnWindows(tag: string, dirSuffix: string): Promi const url = `https://github.com/vim/vim-win32-installer/releases/download/${tag}/gvim_${ver}_x64.zip`; const file = `gvim_${ver}_x64.zip`; const destDir = await installVimAssetOnWindows(file, url, dirSuffix); + const executable = exeName(false, 'windows'); + + // From v9.1.0631, vim.exe and gvim.exe share the same core, so OLE is enabled even in vim.exe. + // This command registers the vim64.dll as a type library. Without the command, vim.exe will + // ask the registration with GUI dialog and the process looks hanging. (#37) + // + // See: https://github.com/vim/vim/issues/15372 + const bin = path.join(destDir, executable); + await exec(bin, ['-silent', '-register']); + return { - executable: exeName(false, 'windows'), + executable, binDir: destDir, }; }