This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Fix venv activate.fish to maintain $status
Type: enhancement Stage: resolved
Components: Library (Lib) Versions: Python 3.6, Python 3.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: Lucretiel, matrixise, python-dev, vinay.sajip
Priority: normal Keywords: patch

Created on 2015-11-19 15:24 by Lucretiel, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
patch.diff Lucretiel, 2015-11-19 15:24 review
patch.diff Lucretiel, 2015-11-20 18:49 review
Messages (5)
msg254906 - (view) Author: Nathan West (Lucretiel) * Date: 2015-11-19 15:24
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 https://github.com/pypa/virtualenv/pull/799
msg255010 - (view) Author: Nathan West (Lucretiel) * Date: 2015-11-20 18:49
Fixed an issue where fish_prompt was returning before calling _old_fish_prompt
msg255019 - (view) Author: Stéphane Wirtel (matrixise) * (Python committer) Date: 2015-11-20 20:20
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
msg260370 - (view) Author: Nathan West (Lucretiel) * Date: 2016-02-16 23:03
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`.
msg275775 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2016-09-11 11:53
New changeset f6125944ffb8 by Vinay Sajip in branch '3.5':
Fixes #25671: Updated prompt handling in activate.fish.
https://hg.python.org/cpython/rev/f6125944ffb8

New changeset ed34b93519ba by Vinay Sajip in branch 'default':
Closes #25671: Merged fix from 3.5.
https://hg.python.org/cpython/rev/ed34b93519ba
History
Date User Action Args
2022-04-11 14:58:24adminsetgithub: 69857
2016-09-11 11:53:43python-devsetstatus: open -> closed

nosy: + python-dev
messages: + msg275775

resolution: fixed
stage: resolved
2016-02-24 02:42:51ned.deilysetnosy: + vinay.sajip

versions: - Python 3.4
2016-02-16 23:03:40Lucretielsetmessages: + msg260370
2015-11-20 20:20:39matrixisesetnosy: + matrixise
messages: + msg255019
2015-11-20 18:49:06Lucretielsetfiles: + patch.diff

messages: + msg255010
2015-11-19 15:24:50Lucretielcreate