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

Relay exit code in poetry run #2904

Closed
wants to merge 2 commits into from

Conversation

pawamoy
Copy link

@pawamoy pawamoy commented Sep 11, 2020

Pull Request Check List

Resolves: #2369

  • Added tests for changed code.
  • Updated documentation for changed code.

I'm a bit stuck. While testing the run command, it seems the tester.io buffer stays empty. Why is that? The command prints things on stdout, the buffer should get them.

Also, it seems the fix has no effect? If I navigated through the code correctly, the script is ultimately run like this:

return os.execvp("python", [
    "python", "-c",
        "import sys; from importlib import import_module; "
        "sys.argv = ('relay', '2'); sys.exit(import_module('project.main').relay())"
])

os.execvp does not return, and rather replaces the current process, so anyway the exit code should be 2, and tester.status_code stays at 0.

Any idea? 😕

@pawamoy pawamoy changed the title wip Relay exit code in poetry run Sep 11, 2020
@pawamoy
Copy link
Author

pawamoy commented Sep 11, 2020

Well OK, the fix does fix the issue, it's just hard to test it. I noticed that the env has _execute = False, so the script is not actually ran, so that explains why the status code is not 2. I tried setting env._execute = True and patching os.execvp with subprocess.call, but the import machinery cannot find the project package. Maybe I'd need to install or fake the installation of the package?

I'm a bit lost 😅

But the fix should actually work 🙂

@pawamoy
Copy link
Author

pawamoy commented May 25, 2021

I'm using PDM now, not interested anymore, feel free to reopen, reuse the code in another PR, or simply ping me!

Copy link

github-actions bot commented Mar 1, 2024

This pull request 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 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

poetry run does not relay exit code
1 participant