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

install-poetry.py doesn't exit with proper status code when installation fails #4424

Closed
1 of 3 tasks
mkniewallner opened this issue Aug 22, 2021 · 2 comments · Fixed by #4425
Closed
1 of 3 tasks

install-poetry.py doesn't exit with proper status code when installation fails #4424

mkniewallner opened this issue Aug 22, 2021 · 2 comments · Fixed by #4425
Labels
kind/bug Something isn't working as expected

Comments

@mkniewallner
Copy link
Member

  • I am on the latest Poetry version. Not applicable, as it's on the installer

  • I have searched the issues of this repo and believe that this is not a duplicate.

  • If an exception occurs when executing a command, I executed it again in debug mode (-vvv option). Not applicable, as it's on the installer

  • OS version and name: ArchLinux and Debian 11

Issue

install-poetry.py doesn't exit with the proper exit code if the installation of Poetry using pip failed.
This is due to subprocess.run command in install_poetry not using check=True to make sure that an exception is raised if the output returned with an exit code other than 0:

poetry/install-poetry.py

Lines 584 to 588 in c967a4a

subprocess.run(
[str(python), "-m", "pip", "install", specification],
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
)

See documentation for subprocess.run https://docs.python.org/3/library/subprocess.html#subprocess.run

If check is true, and the process exits with a non-zero exit code, a CalledProcessError exception will be raised.

Reproducibility

To showcase the issue (and also show what the expected behaviour should be with a fix), I've created a dedicated repository with 2 Dockerfile that GitHub Actions ran on: https://github.com/mkniewallner/showcase-poetry-installer-issue

In the workflow, two jobs have been defined:

  • poetry-master: Tries to install poetry using Python 3.10.0rc1 via install-poetry.py from python-poetry/poetry repository
  • poetry-with-fix: Tries to install poetry using Python 3.10.0rc1 via install-poetry.py from mkniewallner/poetry repository on a commit containg a potential fix

On both jobs, it wasn't possible to install Poetry because of missing system dependencies for cffi module, but:

  • on poetry-master, the step that tries to install Poetry doesn't return with a non-zero exit code, as it run poetry --version just after (see logs)
  • on poetry-with-fix, the step that tries to install Poetry correctly returns with a non-zero exit code, displays the error that happened, and doesn't run poetry --version just after, as the installation failed so it ends the workflow early (see logs)
@mkniewallner mkniewallner added kind/bug Something isn't working as expected status/triage This issue needs to be triaged labels Aug 22, 2021
@finswimmer
Copy link
Member

Thanks a lot for the detailed issue report, problem analysis and solution suggestion 👍 Would like to see more of them 😃

Copy link

github-actions bot commented Mar 2, 2024

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/bug Something isn't working as expected
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants