microsoft / vscode-generator-code

Visual Studio Code extension generator
Other
1.29k stars 222 forks source link

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

Open sammcj opened 1 year ago

sammcj commented 1 year ago
? 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'