Skip to content

Conversation

@PhilReinhold
Copy link
Contributor

@PhilReinhold PhilReinhold commented Dec 19, 2024

Currently, it appears if you pip install quarto-cli, then quarto does not set any error code other than 0.

It looks like this is because the python wrapper which launches the quarto executable does not forward the error codes from the subprocess. Adding a simple return seems to fix this for me.

I believe this would close quarto-dev/quarto-cli#11296

@mubarizafzal
Copy link

This is a great fix :) Would it be possible to have it reviewed and merged?

martheveldhuis
martheveldhuis previously approved these changes Apr 28, 2025
@PhilReinhold
Copy link
Contributor Author

Pinging @cscheid as I think perhaps you are the most currently active quarto developer. Any chance this could be merged?

@cscheid
Copy link
Contributor

cscheid commented Oct 9, 2025

Thanks! Somehow I hadn't gotten a notification for this.

I first wrote "LGTM", but I don't think that anymore. I don't believe this will fix #11926, because quarto doesn't use this library. Why did you think that to be the case?

@cscheid cscheid dismissed martheveldhuis’s stale review October 9, 2025 15:16

(unknown user approved without reason or context.)

@PhilReinhold
Copy link
Contributor Author

You can correct me if I'm wrong, but I think this repository's code is still in the active path if a user installs quarto from pypi instead of from the installer downloaded through some other means. For instance, in my test:

$ uv venv test-quarto

$ source test-quarto/bin/quarto

$ uv pip install quarto-cli

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

$ echo $?
0

$ cat test-quarto/bin/quarto
#!/Users/pcrein/scratch/test-quarto/bin/python3
# -*- coding: utf-8 -*-
import sys
from quarto_cli.quarto import run
if __name__ == "__main__":
    if sys.argv[0].endswith("-script.pyw"):
        sys.argv[0] = sys.argv[0][:-11]
    elif sys.argv[0].endswith(".exe"):
        sys.argv[0] = sys.argv[0][:-4]
    sys.exit(run())

$ cat test-quarto/lib/python3.13/site-packages/quarto_cli/quarto.py
import os
import sys
import subprocess as sp

def run():
        command = os.path.join(os.path.dirname(__file__), "bin", "quarto")
        sp.call([command] + sys.argv[1:])

@cscheid
Copy link
Contributor

cscheid commented Oct 9, 2025

I take it back, you're totally right (I don't use this myself). Ok I'll merge right away. Thanks for following up!

@cscheid cscheid merged commit 43b86dd into quarto-dev:main Oct 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

quarto-cli returns 0 error code on error/failure

4 participants