From c857cc5d0666620eaf1aaa53ce2f0eaeaead4db8 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 29 Jan 2026 19:46:32 +0000 Subject: [PATCH 1/5] Initial plan From fccb9d249eb65bf2966966fa056cc102a0676e1c Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 30 Jan 2026 21:25:36 +0000 Subject: [PATCH 2/5] Fix: append .exe extension to binary paths on Windows when no extension present Co-authored-by: snehara99 <113148726+snehara99@users.noreply.github.com> --- src/parser.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/parser.ts b/src/parser.ts index 39495209..7eb0a076 100644 --- a/src/parser.ts +++ b/src/parser.ts @@ -1624,6 +1624,14 @@ export async function parseLaunchConfigurations( ); } } else { + // On Windows, if the binary has no extension, append .exe + // This ensures VS Code can properly link to the file in the output + if ( + process.platform === "win32" && + !path.extname(compilerTargetBinary) + ) { + compilerTargetBinary += ".exe"; + } logger.message( localize( "producing.target.binary", @@ -1707,6 +1715,15 @@ export async function parseLaunchConfigurations( linkerTool.arguments, ["out", "o"] ); + // On Windows, if the binary has no extension, append .exe + // This ensures VS Code can properly link to the file in the output + if ( + linkerTargetBinary && + process.platform === "win32" && + !path.extname(linkerTargetBinary) + ) { + linkerTargetBinary += ".exe"; + } logger.message( localize( "found.linker.command", From 4175ca1b0a8be83c72b8d51cf7b9e7d67b52b906 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 30 Jan 2026 21:27:38 +0000 Subject: [PATCH 3/5] Simplify: remove redundant platform check in compiler target binary fix Co-authored-by: snehara99 <113148726+snehara99@users.noreply.github.com> --- src/parser.ts | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/parser.ts b/src/parser.ts index 7eb0a076..86672576 100644 --- a/src/parser.ts +++ b/src/parser.ts @@ -1624,12 +1624,9 @@ export async function parseLaunchConfigurations( ); } } else { - // On Windows, if the binary has no extension, append .exe + // If the binary has no extension, append .exe // This ensures VS Code can properly link to the file in the output - if ( - process.platform === "win32" && - !path.extname(compilerTargetBinary) - ) { + if (!path.extname(compilerTargetBinary)) { compilerTargetBinary += ".exe"; } logger.message( From bed880b127a1affaad89d3516dc3a12444d7ef38 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 30 Jan 2026 21:30:07 +0000 Subject: [PATCH 4/5] Add clarifying comment for Windows-specific code block Co-authored-by: snehara99 <113148726+snehara99@users.noreply.github.com> --- src/parser.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/parser.ts b/src/parser.ts index 86672576..f6f46367 100644 --- a/src/parser.ts +++ b/src/parser.ts @@ -1626,6 +1626,7 @@ export async function parseLaunchConfigurations( } else { // If the binary has no extension, append .exe // This ensures VS Code can properly link to the file in the output + // Note: No platform check needed here - this entire block is Windows-specific (see line 1553) if (!path.extname(compilerTargetBinary)) { compilerTargetBinary += ".exe"; } From 88755aa7a5889fb845bd59ec2cb9cdf381d84538 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 3 Feb 2026 04:38:35 +0000 Subject: [PATCH 5/5] Add unit tests for binary path extension handling logic Co-authored-by: snehara99 <113148726+snehara99@users.noreply.github.com> --- src/test/fakeSuite/extension.test.ts | 43 ++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/src/test/fakeSuite/extension.test.ts b/src/test/fakeSuite/extension.test.ts index 5dfcb038..ef89c305 100644 --- a/src/test/fakeSuite/extension.test.ts +++ b/src/test/fakeSuite/extension.test.ts @@ -130,6 +130,49 @@ suite("Unit testing replacing characters in and outside of quotes", () => { }); }); +suite("Unit testing binary path extension handling", () => { + // Tests for the logic that appends .exe extension on Windows + // when binary paths have no extension (fixes issue #698) + + test("path.extname returns empty string for paths without extension", () => { + expect(path.extname("app")).to.be.equal(""); + expect(path.extname("/path/to/app")).to.be.equal(""); + expect(path.extname("C:\\path\\to\\app")).to.be.equal(""); + }); + + test("path.extname returns extension for paths with extension", () => { + expect(path.extname("app.exe")).to.be.equal(".exe"); + expect(path.extname("/path/to/app.exe")).to.be.equal(".exe"); + expect(path.extname("C:\\path\\to\\app.exe")).to.be.equal(".exe"); + expect(path.extname("lib.dll")).to.be.equal(".dll"); + expect(path.extname("file.out")).to.be.equal(".out"); + }); + + test("Appending .exe only when no extension present", () => { + // Simulates the logic in parser.ts for appending .exe on Windows + const appendExeIfNoExtension = (binaryPath: string): string => { + if (!path.extname(binaryPath)) { + return binaryPath + ".exe"; + } + return binaryPath; + }; + + // Paths without extension should get .exe appended + expect(appendExeIfNoExtension("app")).to.be.equal("app.exe"); + expect(appendExeIfNoExtension("/path/to/app")).to.be.equal( + "/path/to/app.exe" + ); + expect(appendExeIfNoExtension("C:\\path\\to\\app")).to.be.equal( + "C:\\path\\to\\app.exe" + ); + + // Paths with extension should remain unchanged + expect(appendExeIfNoExtension("app.exe")).to.be.equal("app.exe"); + expect(appendExeIfNoExtension("lib.dll")).to.be.equal("lib.dll"); + expect(appendExeIfNoExtension("file.out")).to.be.equal("file.out"); + }); +}); + // TODO: refactor initialization and cleanup of each test suite("Fake dryrun parsing", () => { suiteSetup(async function (this: Mocha.Context) {