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

Unexpected stdout chars on neovim job api with pty enabled. #182

Open
supermomonga opened this issue Nov 19, 2024 · 4 comments
Open

Unexpected stdout chars on neovim job api with pty enabled. #182

supermomonga opened this issue Nov 19, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@supermomonga
Copy link

supermomonga commented Nov 19, 2024

Describe the bug

When attempting to start the devcontainer using the :RemoteStart command, an error occurs at the point where the provider tries to execute the devpod command using the executor and then decode the resulting stdout as JSON.

CleanShot 2024-11-19 at 12 38 16

I noticed that unexpected characters were mixed into stdout. As an experiment, I modified the implementation of executor.lua and disabled the pty option on Neovim's job API (vim.fn.jobstart()). By doing so, this error with stdout disappeared.

To reproduce

Minimal steps for reproduce:

vim.fn.jobstart without pty option

  1. Run neovim without any config using nvim -u NONE.
  2. Run :lua vim.fn.jobstart('devpod version', { pty = false, on_stdout = function(_, data, _) vim.api.nvim_echo({data}, true, {}) end })
  3. Run :mes to show echo history

CleanShot 2024-11-19 at 12 33 24

vim.fn.jobstart with pty option

  1. Run neovim without any config using nvim -u NONE.
  2. Run :lua vim.fn.jobstart('devpod version', { pty = true, on_stdout = function(_, data, _) vim.api.nvim_echo({data}, true, {}) end })
  3. Run :mes to show echo history

CleanShot 2024-11-19 at 12 32 18

Expected behavior

:RemoteStart will not fail to parse stdout

Screenshot/Screencast(s)

Please see above description and reproduce steps.

System information

  • Your local OS: macOS 13.6.9
  • CPU model: Apple M2 (Apple Silicon)
  • Local Neovim version: v0.10.2
  • Remote host OS (if applicable): none
  • Remote Neovim version (if applicable): none
  • devpod cli version: v0.6.1

Additional context

I'm using macOS's default terminal app and default shell (zsh).

@supermomonga supermomonga added the bug Something isn't working label Nov 19, 2024
@surgiie
Copy link

surgiie commented Nov 26, 2024

I believe this is what is causing my issues as i asked about here: #184.

@net-caster
Copy link

@surgiie I'm experiencing the same issue too. Just left a comment on your thread

@neevparikh
Copy link

Also seeing this issue, seems like we want https://neovim.io/doc/user/lua.html#vim.system() instead? see note here: https://neovim.io/doc/user/builtin.html#jobstart().

@neevparikh
Copy link

Just a note, swapping all calls to pty=false causes other stuff to break (namely finding free ports on remote), my hack is adding pty to the job opts and passing it in only for the decode call

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

No branches or pull requests

4 participants