Skip to content

poetry run should use execve syscall #993

@ejholmes

Description

@ejholmes
  • I am on the latest Poetry version.
  • 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).
  • OS version and name: any
  • Poetry version: 11.5
  • Link of a Gist with the contents of your pyproject.toml file:

Issue

When running a program through poetry run, subprocess.call is used to execute the command. This has the negative side effect of causing poetry to swallow all signals, making it difficult to wrap commands that depend on signals to be handled properly.

I think the behavior that poetry run should have is that the command provided is exec'd using the exceve syscall, which will replace the process and allow signals to be handled properly. This is similar to the behavior of similar utilities, like bundle exec in ruby.

Poetry should play nice with other unix utilities.

Steps to reproduce

$ cd $(mktemp -d)
$ poetry init
$ go get -u github.com/ejholmes/sigp
$ sigp sleep 60 &
$ kill -TERM $!
signal 15 received (terminated)
signal 20 received (child exited)
$ poetry run sigp sleep 60 &
$ kill -TERM $! # notice that sigp doesn't print anything, because it didn't get the TERM signal
$ ps -A | grep sigp # zombie process now
18862 ttys013    0:00.01 sigp sleep 60

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions