Skip to content

Set environment variable in current shell from child process #18680

@peakschris

Description

@peakschris

Description of the new feature

We launch a python CLI from windows terminal. As a result of certain CLI actions, we want the windows terminal to set certain environment variables as soon as the python CLI command finishes. I understand that this is impossible when launching python from CMD. However, maybe there is some trick to allow it when launching python from Windows Terminal.

We have discarded the option of wrapping the python CLI in a bat or cmd as then we end up with the dreaded 'Terminate (Y/N)' prompt on Ctrl-C.

My hope is that Windows Terminal has some kind of scripting support such that the python subprocess can add an envvar in its parent shell via some kind of API call.

Any other ideas very welcome!

Proposed technical implementation details

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-FeatureComplex enough to require an in depth planning process and actual budgeted, scheduled work.Needs-Author-FeedbackThe original author of the issue/PR needs to come back and respond to somethingNeeds-Tag-FixDoesn't match tag requirementsNeeds-TriageIt's a new issue that the core contributor team needs to triage at the next triage meeting

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions