MicroPico icon indicating copy to clipboard operation
MicroPico copied to clipboard

Switch stubs throw syntax error "&" unexpected

Open ChrisChoke opened this issue 1 year ago • 1 comments

Please provide a clear and concise description of the bug along with logs

What are the steps to reproduce this issue?

  1. switch stubs to esp32

What happens?

syntax error

What were you expecting to happen?

Any logs, error output, etc?

(To get extension logs see Terminal > Output > Extension Host and copy output concerning pico-w-go or micropico) (If it’s long, please paste to https://gist.github.com and insert the link here)

Any other comments?

i think the "&" sign can be removed?!

https://github.com/paulober/MicroPico/blob/77c6868eb93e2d2fb124f45b78c95f504ecc505e/src/stubs.mts#L292

Which version of MicroPico are you using?

3.7.5

Support info

Copy this from the Help -> Info/About -> Copy (Code -> About Visual Studio Code -> Copy on macOS) option in Visual Studio Code:

<paste here>

ChrisChoke avatar Apr 08 '24 11:04 ChrisChoke

Hi. I ran into the exact same problem last night (as in the screenshot below), and it occurred to me that there might be a problem with the & in that line of stubs.mts. I am also using macOS (Sonoma 14.4.1), VScode v1.88.0 and MicroPico v3.7.5. This is a problem that depends on the shell syntax and will probably occur in Linux as well.

I am not currently using Windows, but I think the & at the beginning of the command is probably required by PoweShell. Therefore, instead of simply removing the '&', why not do the following?

  const result = execSync(
    (process.platform === "win32" ? "&" : "") +
    `"${pip}" install ${port}==${version} ` + `--target "${target}" --no-user`,
    process.platform === "win32" ? { shell: "powershell" } : {}
  );

I would send a pull request for the fix, but for some unknown reason the extension (vsix file) built in my cloned repository doesn't work in my environment. So I'll just leave this comment here. For the time being, I modified ~/.vscode/extensions/paulober.pico-w-go-3.7.5-darwin-arm64/dist/extension.cjs directly after installing the extension. :-)

ScreenShot 2024-04-09 10 43 05

wtakuo avatar Apr 09 '24 02:04 wtakuo