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

Attach mode does not work on version 0.2.1 using zsh #277

Closed
plfoley opened this issue Jun 2, 2023 · 46 comments
Closed

Attach mode does not work on version 0.2.1 using zsh #277

plfoley opened this issue Jun 2, 2023 · 46 comments
Assignees
Labels
bug Something isn't working

Comments

@plfoley
Copy link

plfoley commented Jun 2, 2023

When using zsh as the login shell, attaching to a running instance of Rails using UNIX Socket fails with the following error:
connect ENOENT 1337;RemoteHost=<user>@<machine>.local 1337;CurrentDir=/Users/<user>/<repoDir> 1337;ShellIntegrationVersion=13;shell=zsh/var/folders/9v/<TempDir>/ruby-debug-sock-501/ruby-debug-<user>-7957

macOS 13.4
VSCode 1.78.2
rdbg 1.7.1 & 1.8.0
Ruby 2.7.8
Rails 6.0.6

It work fine in version 0.1.0. It got broken in version 0.2.0

It is possible to attach to the process using TCP/IP but no breakpoint will be hit. It is however possible to break on exception when connected in this manner on version 0.2.1.

As reported in this issue, there is no issue when using bash as the login shell on with version 0.2.1

@ono-max
Copy link
Member

ono-max commented Jun 3, 2023

Unfortunately, I'm not able to reproduce your error so far.

@ono-max
Copy link
Member

ono-max commented Jun 3, 2023

I'd appreciate it if you find a way to reproduce this problem. Thank you.

@miharekar
Copy link

miharekar commented Jun 3, 2023

Same issue here. Intel macOS, zsh, chruby 0.3.9, Ruby 3.2.2. Works with 0.1.0.

@ono-max
Copy link
Member

ono-max commented Jun 4, 2023

All right, let's use another approach.

@ono-max
Copy link
Member

ono-max commented Jun 4, 2023

@plfoley @miharekar

Could you check the following steps?

a=1
b=2
c=3
  1. Run $ rdbg target.rb --O
  2. Attach to the debuggee (Attach with rdbg)

In my environment, I confirmed it works.

@ono-max ono-max added the bug Something isn't working label Jun 4, 2023
@miharekar
Copy link

CleanShot 2023-06-04 at 14 54 00

@plfoley
Copy link
Author

plfoley commented Jun 4, 2023

@ono-max I have the same issue as @miharekar.
Please make sure your login shell is set to zsh (macOS default)
sudo chsh -s /bin/zsh
You need to logoff-logon or restart to make it effective.

rdbg-vscode seems to ignore the terminal setting we set un VSCode and always use the Login Shell setting.

For example, If I change my Login Shell to bash:
sudo chsh -s /bin/bash
I can connect my debugger using version 0.2.1 as stated in Issue 250.

@ono-max
Copy link
Member

ono-max commented Jun 5, 2023

Thank you for reporting, but I was not able to reproduce the error 🤔

I'm using the following environment:

  • macOS Version 12.3.1
  • zshell
  • rdbg 1.8.0
  • ruby 3.2.2 (2023-03-30 revision e51014f9c0) [arm64-darwin21]

@ono-max
Copy link
Member

ono-max commented Jun 5, 2023

Also, this is the first time I've seen this long error message. Usually, when attaching to the debuggee failed, I get the error message such as follows:

connect ECONNREFUSED 127.0.0.1:65373

@miharekar
Copy link

Could it be an intel thing? I'm not on arm64 🤔 And I'm on macOS 13.4.

Also, if it helps narrowing down, I'm running oh-my-zsh with powerlevel10k theme.

Other than that our envs are the same.

@ono-max
Copy link
Member

ono-max commented Jun 5, 2023

Hmm, I confirmed it works with the following environment, too:

  • ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x86_64-darwin20]
  • macOS Version 12.2

Thus, I don't think that it's related to OS.

@ono-max
Copy link
Member

ono-max commented Jun 5, 2023

@miharekar @plfoley

Could you check the following steps?

  1. Run $ rdbg target.rb --O

I got the following results in my environment:

$ rdbg target.rb -O
DEBUGGER: Debugger can attach via UNIX domain socket (/var/folders/5j/z2c9zm7124q81f_py4xmd3scp7w9j7/T/ruby-debug-sock-746464807/ruby-debug-s15236-21955)
DEBUGGER: wait for debugger connection...
  1. Run $ rdbg --util=list-socks in another window

I got the following results in my environment:

$ rdbg --util=list-socks
/var/folders/5j/z2c9zm7124q81f_py4xmd3scp7w9j7/T/ruby-debug-sock-746464807/ruby-debug-s15236-21955
  1. Run rdbg -A --sock-path=<socket path>

I got the following results in my environment:

$ rdbg -A --sock-path=/var/folders/5j/z2c9zm7124q81f_py4xmd3scp7w9j7/T/ruby-debug-sock-746464807/ruby-debug-s15236-21955
/var/folders/5j/z2c9zm7124q81f_py4xmd3scp7w9j7/T/ruby-debug-sock-746464807/ruby-debug-s15236-21955

DEBUGGER (client): Connected. PID:21955, $0:target.rb

[1, 10] in target.rb
=>   1| def foo(a, b)
     2|   [a, b]
     3| end
     4| def bar(c, d)
     5|   foo(1, 2);foo(3, 4)
     6| end
     7| 
     8| here = "--- set a breakpoint here ---"
     9| bar 10, 20 # trace "bar" method here.
    10| here = "--- set a breakpoint here ---"
=>#0    <main> at target.rb:1

@ono-max ono-max self-assigned this Jun 5, 2023
@miharekar
Copy link

@ono-max yup, that seems to work just fine

❯ rdbg target.rb --O
DEBUGGER: Debugger can attach via UNIX domain socket (/var/folders/x1/h2b59yq14cs6pv9r_x1_39lw0000gn/T/ruby-debug-sock-501/ruby-debug-miharekar-10869)
DEBUGGER: wait for debugger connection...
DEBUGGER: Connected.
DEBUGGER: GreetingError: HEAD request
DEBUGGER: Disconnected.
DEBUGGER: Connected.
❯ rdbg --util=list-socks
/var/folders/x1/h2b59yq14cs6pv9r_x1_39lw0000gn/T/ruby-debug-sock-501/ruby-debug-miharekar-10869

   ~/Development/personal/rdbg                                                                                                          10:47:10
❯ rdbg -A --sock-path=/var/folders/x1/h2b59yq14cs6pv9r_x1_39lw0000gn/T/ruby-debug-sock-501/ruby-debug-miharekar-10869
DEBUGGER (client): Connected. PID:10869, $0:target.rb

[1, 3] in target.rb
=>   1| a=1
     2| b=2
     3| c=3
=>#0	<main> at target.rb:1
(rdbg:remote)

@st0012
Copy link
Member

st0012 commented Jun 5, 2023

Have you folks tried configuring the new "rdbg.rubyVersionManager" VS Code setting? That fixed a similar error on one of my machines.

@ono-max
Copy link
Member

ono-max commented Jun 5, 2023

Thank you for your quick response!

@miharekar
Copy link

@st0012 just now. Same result.

CleanShot 2023-06-05 at 10 51 15

There is all of this in the VS Code output:

Error: Failed to activate Ruby environment using chruby. Error: Error: Command failed: /bin/zsh -lic 'chruby-exec "ruby-3.2" -- ruby' -rjson -e "printf(%{RUBY_ENV_ACTIVATE%sRUBY_ENV_ACTIVATE}, JSON.dump(ENV.to_h))"
(anon):setopt:7: can't change option: monitor

[�[31mERROR�[39m]: gitstatus failed to initialize.


  Add the following parameter to �[4m~/.zshrc�[24m for extra diagnostics on error:

    �[1mGITSTATUS_LOG_LEVEL=DEBUG�[0m

  Restart Zsh to retry gitstatus initialization:

    �[32m�[4mexec�[24m�[32m zsh�[39m
zsh:1: command not found: chruby

Make sure to install rdbg command (`gem install debug`).
If you are using bundler, write `gem 'debug'` in your Gemfile.
(anon):setopt:7: can't change option: monitor


[�[31mERROR�[39m]: gitstatus failed to initialize.


  Add the following parameter to �[4m~/.zshrc�[24m for extra diagnostics on error:


    �[1mGITSTATUS_LOG_LEVEL=DEBUG�[0m

  Restart Zsh to retry gitstatus initialization:

    �[32m�[4mexec�[24m�[32m zsh�[39m

"(anon):setopt:7: can't change option: monitor\n\n[\u001b[31mERROR\u001b[39m]: gitstatus failed to initialize.\n\n\n  Add the following parameter to \u001b[4m~/.zshrc\u001b[24m for extra diagnostics on error:\n\n    \u001b[1mGITSTATUS_LOG_LEVEL=DEBUG\u001b[0m\n\n  Restart Zsh to retry gitstatus initialization:\n\n    \u001b[32m\u001b[4mexec\u001b[24m\u001b[32m zsh\u001b[39m\n"
["\u001b]1337;[email protected]\u0007\u001b]1337;CurrentDir=/Users/miharekar/Development/personal/rdbg\u0007\u001b]1337;ShellIntegrationVersion=6;shell=zsh\u0007/var/folders/x1/h2b59yq14cs6pv9r_x1_39lw0000gn/T/ruby-debug-sock-501/ruby-debug-miharekar-12243"]
[Start session]
{"d":{},"f":"25fb05b7-d293-4b74-94c7-2552b5508466","g":"rdbg","h":"Attach with rdbg","i":{"uri":{"$mid":1,"fsPath":"/Users/miharekar/Development/personal/rdbg","external":"file:///Users/miharekar/Development/personal/rdbg","path":"/Users/miharekar/Development/personal/rdbg","scheme":"file"},"name":"rdbg","index":0},"j":{"type":"rdbg","name":"Attach with rdbg","request":"attach","__configurationTarget":6,"rdbgExtensions":["traceInspector"],"rdbgInitialScripts":[]}}

Feels like it's related to the theme I metioned above.

Reading this issue it might be that the terminal is invoked in an interactive way, instead of a non-interactive one? I wonder why it works on 0.1.0 and previous versions 🤔

@plfoley
Copy link
Author

plfoley commented Jun 5, 2023

@ono-max Attaching using rdbg in command line works fine for both the test script and Rails.

@st0012 Setting the Ruby Version Manager (rbenv in my case) causes the attach to run in an infinite loop. I have to kill the VSCode window to be able to attach again.

What @miharekar said rang a bell tough. I saw this commit when trying to figure out the issue in the beginning. There seems to be some issue specific to zsh regarding loading the environment configuration when using rbenv. It mentions the interactive shell...

I went in the extension.js:311 file and removed the 'i' option on the shell invocation. My debugger attaches fine now with version 0.2.1 and I am able to hit breakpoints.

@jasonplatts
Copy link

Also having the same issue as @miharekar using a similar configuration.

Mac with Apple M1 Max
macOS 13.4 (22F66)
zsh
rdbg 1.8.0
rbenv 1.2.0
ruby 3.2.2 (2023-03-30 revision e51014f9c0) [arm64-darwin22]

@plfoley
Copy link
Author

plfoley commented Jun 7, 2023

@ono-max I think I found the root cause of the issue. There seems to be a conflict with the decoration happening when loading iTerm2 shell integrations.

You can prevent that from happening by setting TERM=dumb which should not cause side-effects for your extension.

Here is the code I used to test:

	makeShellCommand(cmd: string) {
		const shell = process.env.SHELL;
		if (this.needShell(shell)) {
			const interactiveShellCommand = shell + " -lic '" + cmd + "'"
			if (shell.endsWith("zsh")) {
				return "export TERM=dumb; " + interactiveShellCommand;
			}
			else{
				return interactiveShellCommand;
			}
		} else {
			return cmd;
		}
	}

With this change you can still load ~/.zshrc thus keeping support for rbenv and fix the attach issue.

It would be great if someone who has the same issue would be able to test this locally by replacing the makeShellCommand function in the file /Users/<username>/.vscode/extensions/koichisasada.vscode-rdbg-0.2.1/out/extension.js with the code above and trying to attach.

@ono-max You can reproduce this by installing the iTerm2 Shell Integration and setting your login shell to zsh.
I can create a PR if you give me push rights or you can reintegrate the change yourself as you see fit.

@ono-max
Copy link
Member

ono-max commented Jun 8, 2023

Thank you, @plfoley ! I try to find another approach to fix this problem. However, your solution is the best. Also, I was able to reproduce this problem in your way, and it fixes the problem!

@plfoley Unfortunately, that does not work on Windows. Let me create the PR. Thank you!

ono-max added a commit to ono-max/vscode-rdbg that referenced this issue Jun 8, 2023
Closes ruby#277

The problem is that we can't extract the result from stdout since Oh other zshell framework outputs many strings to stdout.
To prevent it, we add TERM=dumb as a environemnt variable.

Co-authored-by: Pierre-Luc Foley <[email protected]>
ono-max added a commit to ono-max/vscode-rdbg that referenced this issue Jun 8, 2023
Closes ruby#277

The problem is that we can't extract the result from stdout since Oh other zshell framework outputs many strings to stdout.
To prevent it, we add TERM=dumb as a environemnt variable.

Co-authored-by: Pierre-Luc Foley <[email protected]>
ono-max added a commit to ono-max/vscode-rdbg that referenced this issue Jun 8, 2023
Closes ruby#277

The problem is that we can't extract the result from stdout since Oh other zshell framework outputs many strings to stdout.
To prevent it, we add TERM=dumb as a environemnt variable.

Co-authored-by: Pierre-Luc Foley <[email protected]>
ono-max added a commit to ono-max/vscode-rdbg that referenced this issue Jun 8, 2023
Closes ruby#277

The problem is that we can't extract the result from stdout since Oh other zshell framework outputs many strings to stdout.
To prevent it, we add TERM=dumb as a environemnt variable.

Acknowlegement: Thanks to great reserching by @plfoley, we could fix this problem

Co-authored-by: Pierre-Luc Foley <[email protected]>
@plfoley
Copy link
Author

plfoley commented Jun 8, 2023

All yours! Happy to see this fixed.
One thing you could do to improve on my solution would be to test if the file ~/.iterm2_shell_integration.zsh exists.
That would be a a sure-fire way of telling if iTerm2 Shell Integration was deployed but that would increase the coupling with their implementation a bit as well.
It is your call at this point.

@miharekar
Copy link

miharekar commented Jun 8, 2023

@plfoley if I try your makeShellCommand on 0.2.1 I get same error and this in the terminal output:

Error: Failed to activate Ruby environment using chruby. Error: Error: Command failed: export TERM=dumb; /bin/zsh -lic 'chruby-exec "ruby-3.2.2" -- ruby' -rjson -e "printf(%{RUBY_ENV_ACTIVATE%sRUBY_ENV_ACTIVATE}, JSON.dump(ENV.to_h))"
(eval):1: can't change option: zle
zsh:1: command not found: chruby

Make sure to install rdbg command (`gem install debug`).
If you are using bundler, write `gem 'debug'` in your Gemfile.
(eval):1: can't change option: zle

"(eval):1: can't change option: zle\n"
["\u001b]1337;[email protected]\u0007\u001b]1337;CurrentDir=/Users/miharekar/Development/personal/decent-visualizer\u0007\u001b]1337;ShellIntegrationVersion=6;shell=zsh\u0007/var/folders/x1/h2b59yq14cs6pv9r_x1_39lw0000gn/T/ruby-debug-sock-501/ruby-debug-miharekar-66153"]
[Start session]
{"d":{},"f":"cfcbb8ab-f30d-4e4c-a53e-4655fa0856a8","g":"rdbg","h":"Attach with rdbg","i":{"uri":{"$mid":1,"fsPath":"/Users/miharekar/Development/personal/decent-visualizer","external":"file:///Users/miharekar/Development/personal/decent-visualizer","path":"/Users/miharekar/Development/personal/decent-visualizer","scheme":"file"},"name":"decent-visualizer","index":0},"j":{"type":"rdbg","name":"Attach with rdbg","request":"attach","rdbgPath":"PATH=/Users/miharekar/.rubies/ruby-3.2.2/bin:${PATH} /Users/miharekar/.gem/ruby/3.2.2/bin/rdbg","__configurationTarget":6,"rdbgExtensions":["traceInspector"],"rdbgInitialScripts":[]}}

But if I remove test -e ${HOME}/.iterm2_shell_integration.zsh && source ${HOME}/.iterm2_shell_integration.zsh from .zshrc it does indeed fix the issue!

Is there a way to add an if rdbg around this iterm2 sourcing? That would fix the issue and can go into the readme of rdbg that it's required for iterm2 users.

Edit: This fixed it for me inside zshrc 🥳

if [ -z "$VSCODE_CLI" ]; then
  test -e ${HOME}/.iterm2_shell_integration.zsh && source ${HOME}/.iterm2_shell_integration.zsh
fi

@plfoley
Copy link
Author

plfoley commented Jun 8, 2023

@miharekar You would need to reload the extension after you change the code for the changes to take effect. The easiest way of doing this would be to close and re-open your VSCode window. I am sorry I should have mentioned that in my procedure.

The solution you have will indeed work instantaneously as every time you attach, you spawn a new shell and ~/.zshrc get re-evaluated.

Actually the fix you implemented is how I figured out that the issue was with iTerm2 Shell Integrations in the first place. The problem with that solution is that it requires a manual operation on every system. Be also mindful that if you reinstall iTerm2 Shell Extension later, the problem might reappear when changing the content of ~./zshrc.

@miharekar
Copy link

@plfoley I did reload, notice export TERM=dumb; in the log.

@plfoley
Copy link
Author

plfoley commented Jun 8, 2023

@miharekar Sorry I did not see, but you are right, the extension got reloaded fine.

Can you confirm something for me please?
Does the file ~/.iterm2_shell_integration.zsh contains the following condition test (It should be located at the beginning of the file: "$TERM" != dumb

@miharekar
Copy link

@plfoley it does not. I saw there's quite a diff between what I have and what's on their website.

Going to be updating… 😅

@plfoley
Copy link
Author

plfoley commented Jun 8, 2023

@miharekar @ono-max This is what I feared tough. This means we have a weak point with the proposed fix as it won't cover old versions of shell integration scripts.

I think this might require a note in the ReadMe.

@ono-max
Copy link
Member

ono-max commented Jun 8, 2023

Oh, I see. So the current approach is a partial solution.

@miharekar
Copy link

Ideally we'd not load the terminal in the interactive mode.

Instead of coupling with iTerm, you could technically couple with rbenv/chruby since they're both ruby managers and this is a ruby plugin. So instead of relying on interactive terminal to load them, you'd try to load them in the way they should be loaded from their respective readmes. Silently fail if you can't load and give a way in settings to override the "smart ruby manager detection" mode.

@plfoley
Copy link
Author

plfoley commented Jun 8, 2023

It will work for all Shell Integration scripts that were installed after they added the test for TERM=dumb but not for those that were installed before that.

I checked and this condition has been there since at least December 2019 in their code base. The history stops there as the file was maybe moved, but this condition might have been there even before that.

@ono-max
Copy link
Member

ono-max commented Jun 9, 2023

@miharekar

So instead of relying on interactive terminal to load them, you'd try to load them in the way they should be loaded from their respective readmes

You mean, we should run the following command instead of loading shell?

$ eval "$(~/.rbenv/bin/rbenv init - bash)"

Or, we should load .zshrc directory as follows?

$ . ~/.zshrc

@miharekar
Copy link

I meant the eval. Loading zshrc will have the same issue as we have right now, no?

@plfoley
Copy link
Author

plfoley commented Jun 9, 2023

@miharekar is correct: If you load the content of ~/.zshrc you will also load iTerm2 Shell Integration scripts.
What could cause issues would be if rbenv requires something else from the ~/.zshrc to be loaded beforehand.

I am not quite sure to understand why rbenv decided to put its configuration in ~/.zshrc instead of ~/.zshenv.
Clarifying these reasons might give you a better shot at fixing this issue long term.
But I agree with @miharekar and what was said in the Oh My Zsh issue, I don't see why it should require be run in either a login or interactive shell. Since I am new to Ruby, I may lack background information on the matter.

@ono-max
Copy link
Member

ono-max commented Jun 9, 2023

I see. Thanks, guys. I'm not sure about the background of rbenv. Thus, I asked the question.

@ono-max
Copy link
Member

ono-max commented Jun 13, 2023

I noticed that the version managers for Python and Nodejs use .zshrc. Using .zshrc to load initial commands may be a well-known way 🤔

https://github.com/pyenv/pyenv#set-up-your-shell-environment-for-pyenv
https://github.com/nodenv/nodenv#basic-github-checkout
https://github.com/nvm-sh/nvm#deeper-shell-integration

@plfoley
Copy link
Author

plfoley commented Jun 13, 2023

What you say is true, but they mention this just after the ./zshrc setup in the pyenv documentation:

If you wish to get Pyenv in noninteractive login shells as well, also add the commands to ~/.zprofile or ~/.zlogin.

What I don't understand is why they don't suggest putting this in the config file that is common to all shells. They might have some reason for doing so.

@rnystrom
Copy link

I'm also using zsh + chruby and having issues. Either:

  1. I set rubyVersionManager to chruby and it infinitely spins
  2. I set rubyVersionManager to none and the debugger crashes on launch with check_for_activated_spec (which makes sense as I believe its not using chruby)

I expect option 1 is what I should be doing, but I'm confused about the infinite loop. I've had issues before with our setup (chruby + VS Code + rdbg + Ruby LSP) and have the following in both my .zshrc and .zprofile.

# brew
eval "$(/opt/homebrew/bin/brew shellenv)"
export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH"
export PATH="$HOME/.bin:$PATH"

# pyenv
export PYENV_ROOT="$HOME/.pyenv"
command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"

# chruby
source $(brew --prefix)/opt/chruby/share/chruby/chruby.sh
source $(brew --prefix)/opt/chruby/share/chruby/auto.sh
chruby_auto

When I remove the chruby bits from .zprofile I get:

Error: Failed to activate Ruby environment using chruby. Error: Error: Command failed: /bin/zsh -lic 'chruby-exec "3.1.2" -- ruby' -rjson -e "printf(%{RUBY_ENV_ACTIVATE%sRUBY_ENV_ACTIVATE}, JSON.dump(ENV.to_h))"

Which makes sense.

Any tips for debugging and/or working around the infinite spinner?

@plfoley
Copy link
Author

plfoley commented Jun 24, 2023

@rnystrom I encounter the same issue with rbenv. My solution is not to specify the environment manager in the rdbg plugin at all.

In the previous version, I managed to get the debugger to attach by specifying the path of rdbg through the shim in the launch.json tasks like this:
E.G.: "rdbgPath": "~/.rbenv/shims/rdbg"

As of the latest version with the local patch discussed here applied, I don't need to do this anymore however. It might have to do with how I load rbenv in the zsh configurations files. (I did moved it to the global zsh config file)

Sorry I can't be more specific, I am really not familiar with chruby, but at least you have a lead to explore...

@rnystrom
Copy link

Ya selecting none at least doesn't hang up the debugger, but it doesn't debug either (check_for_activated_spec crash).

@bjaglin-swile
Copy link

It looks like we have 2 separate issues being discussed here

  1. the original one from the description, which is a hard failure, independent of the usage of a version manager or not, and likely related to the iterm2 integration
  2. a more recent one, which is a hang/freeze due to the usage of a version manager, without a lead on the root cause at the moment but discussed in Debugger freezes on start without error #295

@andretf
Copy link

andretf commented Oct 18, 2023

@miharekar solution worked for me (not loading iterm shell integration), although Output still have some errors:

tput: No value for $TERM and no -T specified

(anon):setopt:7: can't change option: monitor


[�[31mERROR�[39m]: gitstatus failed to initialize.


  Add the following parameter to ~/.zshrc for extra diagnostics on error:

    GITSTATUS_LOG_LEVEL=DEBUG

  Restart Zsh to retry gitstatus initialization:

    �[32mexec zsh�[39m

"tput: No value for $TERM and no -T specified\n(anon):setopt:7: can't change option: monitor\n\n[\u001b[31mERROR\u001b[39m]: gitstatus failed to initialize.\n\n\n  Add the following parameter to ~/.zshrc for extra diagnostics on error:\n\n    GITSTATUS_LOG_LEVEL=DEBUG\n\n  Restart Zsh to retry gitstatus initialization:\n\n    \u001b[32mexec zsh\u001b[39m\n"
[]
[Start session]

is it possible to at least control what shell profile to use?

@ono-max
Copy link
Member

ono-max commented Oct 22, 2023

I apologize for any inconvenience, everyone. I will be discussing a solution to address these issues with the original author. Please bear with us a moment.

@natesalisbury
Copy link

I'm seeing this same issue but I'm using bash.

image

Setting the Ruby Version Manager to rbenv also gives me an infinite loop like others have reported.

@plfoley
Copy link
Author

plfoley commented Dec 21, 2023

Hi guys,
I have found a probably better way to fix this problem without having to touch the code of the extension or have to tell people to put their rbenv initialization routine in the login shell configuration file.

Wrap your shell integration initialization in the following condition:

if [[ "$TERM_PROGRAM" == "vscode" ]]; then
  test -e "${HOME}/.iterm2_shell_integration.zsh" && source "${HOME}/.iterm2_shell_integration.zsh"
fi

This will prevent the shell integration from being loaded when the parent process is VSCode.
This should probably also work with Oh My Zsh.

I encountered the same problem while playing with the TypeProf extension, so my guess is that this will be a very common occurence in the Ruby world.

I suggest you put something about this somewhere in the extension documentation so people can solve this easily.

HTH

@ono-max
Copy link
Member

ono-max commented Dec 25, 2023

Hello there,

Apologies for the delay in response, Following a through discussion, we have determined that addressing this issue involves resolving the version manager. Consequently, if you encounter the problem, we recommend utilizing the version manager as a solution. The latest version of our extension now incorporates an updated version manager, ensuring seamless functionality without any issues.

We appreciate your patience throughout this process. Should you have any further inquiries, please do not hesitate to reach out. Thank you.

I would like to express special appreciation to @plfoley for his dedicated efforts in assisting with this issue.

@ono-max ono-max closed this as completed Dec 25, 2023
@drewlustro
Copy link

For anyone finding this thread, the issue for me was fzf.

A good way to avoid this problem is to define a special environment variable in launch.json:

"env": {
  "TERM_PROGRAM": "vscode",
}

Then, in .zshrc skip initialization of plugins that invoke zle

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

Successfully merging a pull request may close this issue.

10 participants