microsoft / microsoft/vscode-generator-code

Bug: generator tries to run 'code' from the wrong shell

Open
#378 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
1.6k
Forks
262
Avg merge
15d 22h
Merged PRs (30d)
1

Description

? What type of extension do you want to create? New Extension Pack
? Add the currently installed extensions to the extension pack? Yes
/Users/samm/Library/Application Support/fnm/node-versions/v16.16.0/installation/lib/node_modules/yo/node_modules/yeoman-environment/lib/environment.js:405
    throw error instanceof Error ? error : new Error(error);
    ^

Error: Command failed: code --list-extensions
/bin/sh: code: command not found

    at ChildProcess.exithandler (node:child_process:398:12)
    at ChildProcess.emit (node:events:527:28)
    at ChildProcess.emit (node:domain:475:12)
    at maybeClose (node:internal/child_process:1092:16)
    at Socket.<anonymous> (node:internal/child_process:451:11)
    at Socket.emit (node:events:527:28)
    at Socket.emit (node:domain:475:12)
    at Pipe.<anonymous> (node:net:709:12) {
  code: 127,
  killed: false,
  signal: null,
  cmd: 'code --list-extensions'
}

This occurs because the generator tries to call code with /bin/sh rather than the users current shell:

echo $SHELL
/bin/zsh

and as such doesn't not have the alias to the code binary within the app.

alias code
code='/Applications/Visual\ Studio\ Code.app/Contents/Resources/app/bin/code'
  • macOS 12.6
  • Code: 1.72.6
  • Generator: 4.3.0

Contributor guide

No contributing guide indexed for this repository

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 by reproducing the extension-pack generator flow that runs code --list-extensions, then inspect the child-process invocation shown through node_modules/yeoman-environment/lib/environment.js. Compare its shell environment with the reported /bin/zsh setup and verify the generator completes when the VS Code CLI is available through that setup.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js, vscode, zsh
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.