Skip to content

pid file in virtual environments (feature discussion) #38

@rbscholtus

Description

@rbscholtus

Hi ya
The other day I was running a second instance of a script, running in it's own pipenv virtual environment, and noticed that it didn't run because the pidfile was already created. To make that work, I had to provide a path where the pidfile should be stored for the two virtual environments. Seems to me if a script runs in its own virtual environment, it should manage it's own pidfile, and we shouldn't have to make this explicit.

What I'm proposing is that we make a change to the default location for the pidfile. If we are running in a virtual environment, the pidfile should be created in a subdirectory that resembles the name of the virtual environment, based on sys.prefix, e.g. 'C:\\Users\\username1\\AppData\\Roaming\\test-hvyc-pcr or /run/user/username1/test-hvyc-pcr or ...

The effect of the change is that scripts with the same name but running in different virtual environments can run at the same time, without specifying piddir or pidname.

Happy to code that up but wanted to get opinions first.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions