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

Fix venv activate.fish to maintain $status #69857

Closed
Lucretiel mannequin opened this issue Nov 19, 2015 · 5 comments
Closed

Fix venv activate.fish to maintain $status #69857

Lucretiel mannequin opened this issue Nov 19, 2015 · 5 comments
Labels
stdlib Python modules in the Lib dir type-feature A feature request or enhancement

Comments

@Lucretiel
Copy link
Mannequin

Lucretiel mannequin commented Nov 19, 2015

BPO 25671
Nosy @vsajip, @matrixise
Files
  • patch.diff
  • patch.diff
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2016-09-11.11:53:43.394>
    created_at = <Date 2015-11-19.15:24:50.163>
    labels = ['type-feature', 'library']
    title = 'Fix venv activate.fish to maintain $status'
    updated_at = <Date 2016-09-11.11:53:43.392>
    user = 'https://bugs.python.org/Lucretiel'

    bugs.python.org fields:

    activity = <Date 2016-09-11.11:53:43.392>
    actor = 'python-dev'
    assignee = 'none'
    closed = True
    closed_date = <Date 2016-09-11.11:53:43.394>
    closer = 'python-dev'
    components = ['Library (Lib)']
    creation = <Date 2015-11-19.15:24:50.163>
    creator = 'Lucretiel'
    dependencies = []
    files = ['41079', '41103']
    hgrepos = []
    issue_num = 25671
    keywords = ['patch']
    message_count = 5.0
    messages = ['254906', '255010', '255019', '260370', '275775']
    nosy_count = 4.0
    nosy_names = ['vinay.sajip', 'python-dev', 'matrixise', 'Lucretiel']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue25671'
    versions = ['Python 3.5', 'Python 3.6']

    @Lucretiel
    Copy link
    Mannequin Author

    Lucretiel mannequin commented Nov 19, 2015

    Many fish_prompts use display the $status (fish's equivalent to $?) somewhere in the prompt. Currently, venv's activate.fish overwrites and wraps the user's fish_prompt, the wrapping doesn't preserve this $status. This patch ensures that the $status is correctly restored before invoking the user's fish_prompt.

    This is based on my similar work in virtualenv, at pypa/virtualenv#799

    @Lucretiel Lucretiel mannequin added stdlib Python modules in the Lib dir type-feature A feature request or enhancement labels Nov 19, 2015
    @Lucretiel
    Copy link
    Mannequin Author

    Lucretiel mannequin commented Nov 20, 2015

    Fixed an issue where fish_prompt was returning before calling _old_fish_prompt

    @matrixise
    Copy link
    Member

    I am a user of fish.

    The use case is just execute python -mvenv demo
    source demo/bin/activate.fish

    check the status and deactivate the virtualenv ?

    do you confirm ?

    Thank you

    @Lucretiel
    Copy link
    Mannequin Author

    Lucretiel mannequin commented Feb 16, 2016

    Not quite, no. The issue looks like this:

    user@host ~/test> python3 -mvenv env
    user@host ~/test> true
    user@host ~/test> false
    user@host ~/test [1]> source env/bin/activate.fish 
    (env) user@host ~/test> true
    (env) user@host ~/test> false
    (env) user@host ~/test> deactivate
    user@host ~/test> true
    user@host ~/test> false
    user@host ~/test [1]>
    

    Notice that, after running the false command the first time, the command prompt includes a "[1]", indicating the exit status of the false command. However, after activating the virtual environment, the command prompt no longer shows the error code from the false command. After deactivating the virtualenv, the command prompt once again displays the error code from false.

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Sep 11, 2016

    New changeset f6125944ffb8 by Vinay Sajip in branch '3.5':
    Fixes bpo-25671: Updated prompt handling in activate.fish.
    https://hg.python.org/cpython/rev/f6125944ffb8

    New changeset ed34b93519ba by Vinay Sajip in branch 'default':
    Closes bpo-25671: Merged fix from 3.5.
    https://hg.python.org/cpython/rev/ed34b93519ba

    @python-dev python-dev mannequin closed this as completed Sep 11, 2016
    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    stdlib Python modules in the Lib dir type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant