VSCodeVim / VSCodeVim/Vim

Incomplete `$PATH` for `:!` command

Open
#7,065 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
15.2k
Forks
1.5k
Avg merge
3d 18h
Merged PRs (30d)
6

Description

Describe the bug
Any command run with the :! <shell-command command seems to run with a very basic PATH set:

To Reproduce
Simply type:

:%!echo $PATH

in an empty file to see the $PATH. For me, it is just /usr/bin:/bin:/usr/sbin:/sbin. This is not enough to pick up executables installed somewhere else (like with homebrew on mac for example, I have jq installed to /usr/local/bin/jq, which is not picked up).

:%!jq .

with jq installed to /usr/local/bin should json pretty-print the current file with jq as an example. Note that

:%!/usr/local/bin/jq .

actually works

Expected behavior
%:! <shell-command> should pick-up commands from /usr/local/bin too.

Environment (please complete the following information):

  • Extension (VsCodeVim) version: 1.21.7
  • VSCode version: Version: 1.60.0 (Universal)
  • OS: Mac OS Big Sur 11.4 (20F71)

Additional context
Is this maybe somehow configurable through vscode settings? I was digging through the code and it seems like !: is just using child_process.exec...

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in src/util/externalCommand.ts around line 88, where the issue identifies child_process.exec as the implementation for :! commands. Reproduce with :%!echo $PATH and :%!jq ., then verify that commands installed in /usr/local/bin are found without using an absolute path.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, typescript
Domain
devtools
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.