ziglang / zig.vim

Vim configuration for Zig
MIT License
448 stars 56 forks source link

Redirect `zig env` stderr to /dev/null #98

Open mitchellh opened 1 year ago

mitchellh commented 1 year ago

Here:

https://github.com/ziglang/zig.vim/blob/0c4f965468259ab6e47fd7c6b2127583a8860eb1/ftplugin/zig.vim#L39

On my NixOS system, when the dynamic linker is broken (an upstream bug that I'm waiting for a fix), it outputs some garbage to stderr about not being able to do some linking but otherwise runs the command successfully. However, zig.vim breaks because it tries to parse the full output as json.

To make this more robust, we should redirect stderr to /dev/null and just parse stdout. system always executes in the context of a shell1 so we just have to use 2>/dev/null.

I know this isn't zig.vim's bug, but this would make it more robust to system issues.