formulahendry / formulahendry/vscode-code-runner

[Bug] compiled file does not run on windows

Open
#1,114 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
2.4k
Forks
351
PR merge metrics
No merged PRs in 30d

Description

- VS Code Version: 1.87.2
- OS Version: Windows 11 (latest updates)
- Code Runner Version: 0.12.1

**Describe the bug**
Depending on the name of the source code file (c and cpp), the extension can compile it, but does not properly execute the compiled file, as the .exe extension ends up being omitted in the generated file.

**To Reproduce**
An example of a file name that generates the problem would be "test1.1.c". When trying to run "Run", the file "test1.1" is generated, but Windows cannot run it as it is missing the .exe extension. The issue can be mitigated by changing the executor map as follows:

From this:

```
"code-runner.executorMap": {
...
"c": "cd $dir && gcc $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt",
...
}
```

To that:

```
"code-runner.executorMap": {
...
"c": "cd $dir && gcc $fileName -o $fileNameWithoutExt.exe && $dir$fileNameWithoutExt.exe",
...
}
```

**Actual behavior**
Windows doesn't know how to run an executable file that doesn't have the explicit .exe extension.

**Expected behavior**
Execute the file appropriately.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.