code-server icon indicating copy to clipboard operation
code-server copied to clipboard

[Bug]: When using the command "code-server --install-extension", a failed installation returns exit code 0

Open SantiSuarezMS opened this issue 2 years ago • 12 comments
trafficstars

Is there an existing issue for this?

  • [X] I have searched the existing issues

OS/Web Information

  • Local OS: macOS
  • Remote OS: Ubuntu
  • Remote Architecture: amd64
  • code-server --version: 4.11.0

Steps to Reproduce

  1. On the Terminal run code-server --install-extension non.existing-extension && echo "Exit code: " "$?"
  2. Wait for the command to finish and check the output.

Expected

At the end of the output it should read:

Exit code:  1

Or any other non 0 appropriate exit code.

Actual

At the end of the output it reads:

Exit code:  1

Logs

No response

Screenshot/Video

No response

Does this issue happen in VS Code or GitHub Codespaces?

  • [X] I cannot reproduce this in VS Code.
  • [X] I cannot reproduce this in GitHub Codespaces.

Are you accessing code-server over HTTPS?

  • [X] I am using HTTPS.

Notes

As part of a pipeline, I have a script that install some extensions using code-server --install-extension, whenever one of the installed extensions fails I expect the whole script to fail, cascading to the pipeline fail so I can take action. Instead, as it is returning 0 even when the task is failing, the build finishes with a false success.

SantiSuarezMS avatar Aug 03 '23 18:08 SantiSuarezMS

@SantiSuarezMS don't you mean: "Actual: At the end of the output it reads: Exit code 0" (instead of 1) ?

I consider this a bug as well, or at least bad UX, as one can not use this command in a script and react to failing. Any comments from a contributor/developer on this?

turbotimon avatar Jan 11 '24 15:01 turbotimon

I can reproduce this in GitHub Codespaces.

benz0li avatar Jan 11 '24 16:01 benz0li

And it is present in both <install-path>/bin/code-server (i.e. code-server called from Terminal) as well as <install-path>/lib/vscode/bin/remote-cli/code-server (i.e. code-server called from code-server's Terminal).

IMHO rather a vscode (remote-cli) issue than a code-server issue.

benz0li avatar Jan 11 '24 16:01 benz0li

not exactly sure what you mean by "vscode (remot-cli)" but ms vscode (v1.84.2) behaves correctly: code --install-extension non.existing-extension will return 1. vscodium as well behaves correctly.

turbotimon avatar Jan 11 '24 20:01 turbotimon

Yeah in the integrated terminal we just use the script that comes bundled with VS Code (the server/web CLI is different than the native one) so it sounds like an upstream bug.

code-asher avatar Jan 11 '24 21:01 code-asher

We can fix what we can on our end though, the one that runs outside the integrated terminal. Will push that fix in a bit.

Edit: This one still does not quite work because the error does not appear to propagate so there is nothing to catch, but that needs to be fixed upstream.

code-asher avatar Jan 11 '24 21:01 code-asher

Can we please an issue on the upstream repo then? I would like to do so, but as i'm not familiar with the server/web CLI version, i'm not sure where to place and how to describe it correctly..

turbotimon avatar Jan 12 '24 07:01 turbotimon

Sorry for letting this fall through the cracks. If someone wants to submit this upstream, I think it should be sufficient to reproduce in Codespaces (I believe the command there will be code though and not code-server) and use that information to open the issue.

code-asher avatar Mar 12 '24 19:03 code-asher

note this does work as expected in the microsoft code-server version

michaelbrewer avatar Apr 04 '24 14:04 michaelbrewer

I tested after updating to 1.88.0 but unfortunately the problem persists. Not sure why Microsoft's works. :thinking: Does it work within the integrated terminal as well, or only outside? Codespace's is still broken too.

code-asher avatar Apr 06 '24 00:04 code-asher

Ah nevermind I tested, it does not work in the integrated terminal with Microsoft's either.

code-asher avatar Apr 06 '24 00:04 code-asher

Wait, I see why. I can fix the exit code from the external script, but the one from the integrated terminal is still an upstream bug.

code-asher avatar Apr 06 '24 00:04 code-asher

I will go ahead and close this as an upstream bug.

code-asher avatar Jul 12 '24 22:07 code-asher