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

fix: console.log() writes to RPC channel #332

Merged
merged 7 commits into from
Mar 16, 2024
Merged

fix: console.log() writes to RPC channel #332

merged 7 commits into from
Mar 16, 2024

Conversation

justinmk
Copy link
Member

Problem:
2d47447 removed "sandboxing" and accidentally also removed the console.log monkey-patching. This means a random call to console.log can write to stdout, which breaks the RPC channel.

Solution:
Re-implement the patching.

fix #202
fix #329

@justinmk justinmk force-pushed the fixconsolelog branch 6 times, most recently from 1be5ec0 to aac45ab Compare March 16, 2024 18:10
Problem:
2d47447 removed "sandboxing" and
accidentally also removed the console.log monkey-patching. This means
a random call to `console.log` can write to stdout, which breaks the RPC
channel.

Solution:
Re-implement the patching.

fix #202
fix #329
before:

    {"level":"debug","message":"request -> neovim.api.nvim_list_bufs"}
    {"level":"debug","message":"request -> neovim.api.nvim_command"}
    {"level":"debug","message":"request -> neovim.api.nvim_get_current_tabpage"}
    {"level":"debug","message":"response -> neovim.api.nvim_command: null"}
    {"level":"debug","message":"response -> neovim.api.nvim_get_current_tabpage: [object Object]"}

after

    2024-03-16 15:01:14 DBG request -> neovim.api.nvim_eval
    2024-03-16 15:01:14 DBG request -> neovim.api.nvim_get_current_tabpage
    2024-03-16 15:01:15 DBG response -> neovim.api.nvim_get_current_tabpage: [object Object]
    2024-03-16 15:01:15 DBG request -> neovim.api.nvim_get_current_tabpage
    2024-03-16 15:01:15 DBG request -> neovim.api.nvim_get_current_win
- annotate types.
- rename helpers/ => utils/
  - there are already other "utils/" directories
  - helpers is a stupid name
Use findNvim() instead of "which".
Can't do "global beforeAll" because jest sucks.
@justinmk justinmk merged commit 104f063 into master Mar 16, 2024
11 checks passed
@justinmk justinmk deleted the fixconsolelog branch March 16, 2024 18:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

console.log() crashes Nvim or exits node Not seeing logs from my plugin
1 participant