question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unexpected backslash with OSC 9;9 prompt

See original GitHub issue

Prerequisites

Steps to reproduce

  1. Configure OSC 9;9 for PowerShell and add custom prompt in $PROFILE following https://learn.microsoft.com/en-us/windows/terminal/tutorials/new-tab-same-directory#powershell-powershellexe-or-pwshexe:
function prompt {
  $loc = $executionContext.SessionState.Path.CurrentLocation;

  $out = "PS $loc$('>' * ($nestedPromptLevel + 1)) ";
  if ($loc.Provider.Name -eq "FileSystem") {
    $out += "$([char]27)]9;9;`"$($loc.ProviderPath)`"$([char]27)\"
  }
  return $out
}
  1. Type a single quote ' or a dot .

Expected behavior

PS> '

Actual behavior

PS>\'

Error details

No response

Environment data

PS /home/yen/tmp/PowerShell> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      7.4.0-preview.3
PSEdition                      Core
GitCommitId                    7.4.0-preview.3
OS                             Linux 6.3.8-arch1-1 PowerShell/PowerShell#1 SMP PREEMPT_DYNAMIC Wed, 14 Jun 2023 20:10:31 +0000
Platform                       Unix
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

I can also reproduce the issue with PowerShell 7.3.4 on Windows 10 22H2.

Visuals

圖片

This is captured with Konsole 23.04.2 and tmux 3.3a. I can reproduce the same issue with PowerShell 7.3.4 on Windows 10 22H2.

Issue Analytics

  • State:open
  • Created 3 months ago
  • Comments:10 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
daxian-dbwcommented, Jul 26, 2023

Unfortunately, we don’t own that doc.

1reaction
daxian-dbwcommented, Jul 25, 2023

I can reproduce the issue after moving the prompt function to $PROFILE. We will investigate it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Syntax error while using backslash in Jenkinsfile
And I got an error WorkflowScript: 4: unexpected char: '\' . How can I use path with whitespace on it without using backslash?...
Read more >
Distinguish local and remote terminals
Tutorial on using colors to quickly distinguish terminal windows with active SSH sessions from local sessions.
Read more >
Groovy syntax not working with backslashes
When I try to build this command on a Jenkins pipeline give me an error about this syntax. Even before I do this...
Read more >
Clink v1.5.1
Name Default * Description autosuggest.enable False * clink.promptfilter True Enable prompt filtering by Lua scripts. lua.break_on_error False Breaks into Lua debugger on Lua errors.
Read more >
Getting Started
Our comprehensive services guide provides an overview of our resources and how you can use them. Cluster computing: OSC offers three supercomputer clusters...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found