Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

quarto-cli returns 0 error code on error/failure #11296

Open
imdando opened this issue Nov 4, 2024 · 4 comments · May be fixed by quarto-dev/quarto-cli-pypi#3
Open

quarto-cli returns 0 error code on error/failure #11296

imdando opened this issue Nov 4, 2024 · 4 comments · May be fixed by quarto-dev/quarto-cli-pypi#3
Assignees
Labels
bug Something isn't working pip-packaging Issues with Quarto as packaged on PyPI

Comments

@imdando
Copy link

imdando commented Nov 4, 2024

Bug description

Looks like the same problem as #10307 but seems to still be an issue (at least on windows)

OS:
quarto_cli version: 1.5.57 (also reproduced on 1.6.32)

Steps to reproduce

install latest stable quarto-cli from pypi

pip install quarto_cli

quarto --version
1.5.57

Error does not get reflected in a non-zero error code.

(.venv) C:\Dev\Projects\quarto_repro>quarto blah
ERROR: Unknown command "blah". Did you mean command "use"?

(.venv) C:\Dev\Projects\quarto_repro>echo %errorlevel%
0

Same behaviour also observed on latest pre-release 1.6.32

Expected behavior

exit code should be non-zero

Actual behavior

exit code is zero when quarto command fails (due to invalid arguments, or when something else fails)

Your environment

OS: Windows 11 (10.0.22631 Build 22631)
IDE: n/a

Quarto check output

(.venv) C:\Dev\Projects\quarto_repro>quarto check
Quarto 1.5.57
[>] Checking versions of quarto binary dependencies...
      Pandoc version 3.2.0: OK
      Dart Sass version 1.70.0: OK
      Deno version 1.41.0: OK
      Typst version 0.11.0: OK
[>] Checking versions of quarto dependencies......OK
[>] Checking Quarto installation......OK
      Version: 1.5.57
      Path: C:\Dev\Projects\quarto_repro\.venv\Lib\site-packages\quarto_cli\bin
      CodePage: 1252

[>] Checking tools....................OK
      TinyTeX: (not installed)
      Chromium: (not installed)

[>] Checking LaTeX....................OK
      Tex:  (not detected)

[>] Checking basic markdown render....OK

[>] Checking Python 3 installation....OK
      Version: 3.12.5
      Path: C:/Dev/Projects/quarto_repro/.venv/Scripts/python.exe
      Jupyter: 5.7.2
      Kernels: python3

[>] Checking Jupyter engine render....OK

[>] Checking R installation...........OK
      Version: 4.3.1
      Path: C:/PROGRA~1/R/R-43~1.1
      LibPaths:
        - C:/Users/A13325/AppData/Local/R/win-library/4.3
        - C:/Program Files/R/R-4.3.1/library
      knitr: 1.45
      rmarkdown: 2.27

[>] Checking Knitr engine render......OK
@imdando imdando added the bug Something isn't working label Nov 4, 2024
@cderv
Copy link
Collaborator

cderv commented Nov 4, 2024

Same behaviour also observed on latest pre-release 1.6.32

I can't reproduce on powershell

❯ quarto --version
1.6.32$LASTEXITCODE
0

❯ quarto blah
ERROR: Unknown command "blah". Did you mean command "use"?$LASTEXITCODE
1

I can't reproduce on CMD either using quarto.exe (nor quarto.cmd)

> quarto.exe --version
1.6.32

>echo %ERRORLEVEL%
0

>quarto.exe blah
ERROR: Unknown command "blah". Did you mean command "use"?

> echo %ERRORLEVEL%
1

I'll try installing using Pip to see, but I believe this would be similar return.

Can you try in powershell on your side too ?

@cderv
Copy link
Collaborator

cderv commented Nov 4, 2024

I can reproduce in the context of the virtual environment. 🤔
I wonder if %ERRORLEVEL% in this case is not really the exit code of the quarto command but something else done by the virtual env activation for the shell 🤔 It is the same in powershell or CMD when virtualenv is activated. If not activated it works ok.

I can't see why right now this would be different than when using outside.

@cscheid cscheid added python-setup Issues with Python's environment and setup pip-packaging Issues with Quarto as packaged on PyPI and removed python-setup Issues with Python's environment and setup labels Nov 4, 2024
@cderv
Copy link
Collaborator

cderv commented Nov 4, 2024

It seems to be something with the python packaging in https://github.com/quarto-dev/quarto-cli-pypi

I can reproduce by just using the quarto.exe install in the virtual environment, without activating the environment.

>C:\Users\chris\.virtualenvs\error-hQkzJkn5\Scripts\quarto.exe blah
ERROR: Unknown command "blah". Did you mean command "use"?

>echo %ERRORLEVEL%
0

> C:\Users\chris\.virtualenvs\error-hQkzJkn5\Scripts\quarto.exe --version
1.5.57

>echo %ERRORLEVEL%
0

@cscheid cscheid self-assigned this Nov 4, 2024
@imdando
Copy link
Author

imdando commented Nov 4, 2024

Thanks for helping to reproduce this.
Yes I tried in powershell, cmd and git-bash as well (for what its worth...), though all from within a venv installed using pip so that seems to be the common denominator

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working pip-packaging Issues with Quarto as packaged on PyPI
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants