8000 Unexport CMD_DURATION by bhamiltoncx · Pull Request #1896 · fish-shell/fish-shell · GitHub
[go: up one dir, main page]

Skip to content

Unexport CMD_DURATION#1896

Merged
sugar700 merged 1 commit intofish-shell:masterfrom
bhamiltoncx:unexport-cmd-duration
Jan 17, 2015
Merged

Unexport CMD_DURATION#1896
sugar700 merged 1 commit intofish-shell:masterfrom
bhamiltoncx:unexport-cmd-duration

Conversation

@bhamiltoncx
Copy link
Contributor

Valid uses of the CMD_DURATION environment variable don't seem to include passing
it to subsequent child processes.

I work on the Buck build system at Facebook (http://facebook.github.io/buck/). One of Buck's features is to discard its cache if anything in the calling environment has changed since the last run:

https://github.com/facebook/buck/blob/master/src/com/facebook/buck/parser/Parser.java#L950

For all shells except fish, this is no problem. However, since fish exports CMD_DURATION to all sub-processes with a different value each time, Buck always discards its cache between runs, so it performs terribly.

I confirmed the variable is still available inside the shell by running:

function fish_prompt
    echo "duration [$CMD_DURATION] "
end

duration [0] sleep 2
duration [2002]

Valid uses of this environment variable don't really include passing
it to subsequent child processes.

I confirmed the fix with:

  function fish_prompt
      echo "cmd duration [$CMD_DURATION] "
  end

  cmd duration [0] sleep 2
  cmd duration [2002]
@sugar700 sugar700 merged commit b31305b into fish-shell:master Jan 17, 2015
@zanchey zanchey added this to the next-minor milestone Jan 17, 2015
@zanchey zanchey added the docs An issue/PR that touches or should touch the docs label Jan 17, 2015
@zanchey
Copy link
Member
zanchey commented Jan 17, 2015

This will need a note in the release notes, although it seems unlikely that anyone is depending on this behaviour.

@sugar700
Copy link
Contributor

In theory, someone could have a fish prompt implemented in different programming language using environment variable, but I would consider it unlikely (quick search on GitHub has shown one prompt not written in fish shell using CMD_DURATION, but even in this case the program generating a prompt gets explicit CMD_DURATION argument. Besides, even if it's a case, a parameter can be passed explicitly.

@bhamiltoncx bhamiltoncx deleted the unexport-cmd-duration branch January 20, 2015 17:49
@faho faho removed the docs An issue/PR that touches or should touch the docs label Aug 10, 2015
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 17, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

0