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

Adopt argsCanBeInterpretedByShell for external terminals #155794

Open
roblourens opened this issue Jul 21, 2022 · 3 comments
Open

Adopt argsCanBeInterpretedByShell for external terminals #155794

roblourens opened this issue Jul 21, 2022 · 3 comments
Assignees
Labels
debt Code quality issues debug Debug viewlet, configurations, breakpoints, adapter issues
Milestone

Comments

@roblourens
Copy link
Member

From #149910 and #149910

This is handled in a different way than for the integrated terminal - escaping never happened here...

@roblourens roblourens added debug Debug viewlet, configurations, breakpoints, adapter issues debt Code quality issues labels Jul 21, 2022
@roblourens roblourens added this to the August 2022 milestone Jul 21, 2022
@roblourens roblourens self-assigned this Jul 21, 2022
@weinand
Copy link
Contributor

weinand commented Aug 3, 2022

@roblourens since the external terminals are platform (and terminal) specific, escaping (or quoting) is done in different ways.

On macOS the quoting is done in the iTerm and Terminal AppleScript helpers:

CleanShot 2022-08-03 at 16 00 33@2x

@roblourens
Copy link
Member Author

I just realized that this code is for all external terminals, not debug specific, and escaping is all handled differently.

@Tyriar @meganrogge

  • Linux and windows - do you want to use the more precise escaping from and
    quote = (s: string) => {
    // Note: Wrapping in cmd /C "..." complicates the escaping.
    // cmd /C "node -e "console.log(process.argv)" """A^>0"""" # prints "A>0"
    // cmd /C "node -e "console.log(process.argv)" "foo^> bar"" # prints foo> bar
    // Outside of the cmd /C, it could be a simple quoting, but here, the ^ is needed too
    s = s.replace(/\"/g, '""');
    s = s.replace(/([><!^&|])/g, '^$1');
    return (' "'.split('').some(char => s.includes(char)) || s.length === 0) ? `"${s}"` : s;
    ? Currently the escaping for external terminals only looks for spaces in an arg. I could try to share this escaping function.
  • Mac - whatever the applescript is doing for quoting is probably fine

@Tyriar
Copy link
Member

Tyriar commented Aug 5, 2022

@roblourens sounds good to me, I think debug may actually be the only consumer of runInTerminal in externalTerminal

@rebornix rebornix modified the milestones: October 2022, November 2022 Oct 25, 2022
@roblourens roblourens modified the milestones: February 2023, March 2023 Feb 21, 2023
@roblourens roblourens modified the milestones: March 2023, April 2023 Mar 21, 2023
@roblourens roblourens modified the milestones: April 2023, May 2023 Apr 26, 2023
@roblourens roblourens modified the milestones: May 2023, June 2023 May 31, 2023
@roblourens roblourens modified the milestones: June 2023, Backlog Jun 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
debt Code quality issues debug Debug viewlet, configurations, breakpoints, adapter issues
Projects
None yet
Development

No branches or pull requests

4 participants