Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run in terminal doesn't work with Powershell #535

Closed
hasali19 opened this issue Sep 6, 2018 · 4 comments · Fixed by #2671
Closed

Run in terminal doesn't work with Powershell #535

hasali19 opened this issue Sep 6, 2018 · 4 comments · Fixed by #2671
Labels
Milestone

Comments

@hasali19
Copy link

hasali19 commented Sep 6, 2018

Brief Issue Summary

Right clicking on a target in the cmake project outline and selecting the 'Run in terminal' option doesn't work if the terminal is set to Powershell, since the path is in quotes, so it just prints back the path.

PS D:\hasan\Projects\HelloWorld> "D:\hasan\Projects\HelloWorld\build\HelloWorld.exe"
D:\hasan\Projects\HelloWorld\build\HelloWorld.exe

To execute the program the path must be prefixed with '& '.

PS D:\hasan\Projects\HelloWorld> & "D:\hasan\Projects\HelloWorld\build\HelloWorld.exe"
Hello, world!

Platform and Versions

  • Operating System: Windows
  • CMake Version: 3.11.4
  • VSCode Version: 1.26.1
  • CMake Tools Extension Version: 1.1.1
  • Compiler/Toolchain: Visual C++ 2017
@vector-of-bool
Copy link
Contributor

Sorry for the lack of responsiveness.

Ouch. This is kind of troublesome. Starting a process with a shell in VSCode consists of starting the shell in a terminal, then feeding the command text into stdin, followed by a newline to execute in the shell. There isn't a reliable way to know what shell will actually be executed. I can check the shell value in settings.json, but that provides little information on what the shell actually is. May require more investigation.

@vector-of-bool vector-of-bool added the bug a bug in the product label Sep 17, 2018
@vector-of-bool vector-of-bool added this to the Backlog milestone Sep 17, 2018
@amir-arad
Copy link

same happens with checking gdb:

[proc] Executing command: "C:/Program Files (x86)/mingw-w64/i686-7.3.0-win32-dwarf-rt_v5-rev0/mingw32/bin/gdb.exe" --version
[proc] Executing command: gdb --version

@KoeMai
Copy link
Contributor

KoeMai commented Dec 23, 2018

The first issue part is the same as #601.
The last comment seems to be something different. I think it is a problem with detection of gdb, it does not use the PATH variables from the selected kit.

@LucasOe
Copy link

LucasOe commented Jul 28, 2022

This has been an issue for four years now. All that's missing is a dot or an "&" before the path.

If it's not possible to detect which terminal is being used, maybe add an option to choose which terminal to use instead of using the terminal.integrated.defaultProfile.* setting. When using a build task defined in tasks.json VSCode seems to be using the cmd by default for me. Cmake only uses the profile defined in the terminal.integrated.defaultProfile.* setting, when the executable is being built from the toolbar without a default build task inside tasks.json.

@bobbrow bobbrow linked a pull request Aug 3, 2022 that will close this issue
@bobbrow bobbrow modified the milestones: Backlog, 1.12 Aug 3, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Sep 23, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants