Hyper: Environment variables using other environment vairables does not work in Hyper.app

Created on 22 Apr 2018  路  6Comments  路  Source: vercel/hyper

  • [x] Your Hyper.app version is 2.0.0. Please verify your using the latest Hyper.app version
  • [x] I have searched the issues of this repo and believe that this is not a duplicate

  • Any relevant information from devtools? _(CMD+ALT+I on macOS, CTRL+SHIFT+I elsewhere)_:
    N/A

  • Is the issue reproducible in vanilla Hyper.app?
    Is Vanilla.

Issue

Environment variables uses other env variables does not work.
E.g. I have a env variable BNP_PIP3, point to pip3 executable path. I use %BNP_PIP3% in my Windows PATH env variable.

Then the BNP_PIP3 wont expand inside the PATH in Hyper Terminal.

# Use zsh
$ echo $PATH
> .....:%BNP_PIP3%

  • Hyper version: undefined "2.0.0"
  • OS ARCH VERSION: win32 x64 10.0.16299
  • Electron: 1.8.4 LANG: undefined
  • SHELL: (oh-my-)zsh TERM: msys2-64


    ~/.hyper.js contents


    {
    "updateChannel": "stable",
    "fontSize": 15,
    "fontFamily": "\"Fira Code Retina\", Menlo, \"DejaVu Sans Mono\", Consolas, \"Lucida Console\", monospace",
    "fontWeight": "normal",
    "fontWeightBold": "bold",
    "cursorColor": "rgba(248,28,229,0.8)",
    "cursorAccentColor": "#000",
    "cursorShape": "BEAM",
    "cursorBlink": false,
    "foregroundColor": "#fff",
    "backgroundColor": "#000",
    "selectionColor": "rgba(248,28,229,0.3)",
    "borderColor": "#333",
    "css": "",
    "termCSS": "",
    "showHamburgerMenu": true,
    "showWindowControls": true,
    "padding": "12px 14px",
    "colors": {
    "black": "#000000",
    "red": "#C51E14",
    "green": "#1DC121",
    "yellow": "#C7C329",
    "blue": "#0A2FC4",
    "magenta": "#C839C5",
    "cyan": "#20C5C6",
    "white": "#C7C7C7",
    "lightBlack": "#686868",
    "lightRed": "#FD6F6B",
    "lightGreen": "#67F86F",
    "lightYellow": "#FFFA72",
    "lightBlue": "#6A76FB",
    "lightMagenta": "#FD7CFC",
    "lightCyan": "#68FDFE",
    "lightWhite": "#FFFFFF"
    },
    "shell": "D:\Program Files\msys2\usr\bin\zsh.exe",
    "shellArgs": [
    "--login",
    "-i"
    ],
    "env": {
    "CHERE_INVOKING": 1,
    "MSYS2_PATH_TYPE": "inherit"
    },
    "bell": "SOUND",
    "copyOnSelect": false,
    "defaultSSHApp": true
    }

    {
    "plugins": [],
    "localPlugins": []
    }


Most helpful comment

My bad, I think.

  • env vars are copied from parent environment. That is, if you open cmd.exe from start menu, you copy the system's env vars. If you open cmd.exe from something like AltRun, it copy env vars from AltRun. If AltRun is not restarted, the env vars will not be updated.
  • The %PATH% evaluation only works if all %variable% paths are accessible. If one of these are not accessible, the %PATH% will show the raw string with %variables% inside.

I called Hyper from desktop, and called cmder from AltRun. They have different startup environment.

All 6 comments

Is it working with regular cygwin/gitbash?
I think that %variable% is only evaluated on CMD/Powershell.

Sorry, my bad.

The %variable% is not evaluated in msys2 or zsh. However, it is evaluated inside cmder with msys2/zsh.

I think cmder ported the env variables into its environment.

If it works in another term (cmder), we should understand what is the convenient trick and do the same

image
It is ConEmu's trick, and cmder is a package using ConEmu.

After testing, I found this settings (PATH in picture) was passed into zsh shell.
Perhaps it has a cmd wrapper outside the zsh call. The PATH env variables are evaluated in cmd, and zsh in msys2 shares the environment with parent by using "MSYS2_PATH_TYPE": "inherit".

By the way, in Hyper.app, cmd does not evaluate those variables, either. Screenshots:
image
image

My bad, I think.

  • env vars are copied from parent environment. That is, if you open cmd.exe from start menu, you copy the system's env vars. If you open cmd.exe from something like AltRun, it copy env vars from AltRun. If AltRun is not restarted, the env vars will not be updated.
  • The %PATH% evaluation only works if all %variable% paths are accessible. If one of these are not accessible, the %PATH% will show the raw string with %variables% inside.

I called Hyper from desktop, and called cmder from AltRun. They have different startup environment.

@boxsnake thank you for your explanations 馃檹

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sarneeh picture sarneeh  路  3Comments

weabot picture weabot  路  3Comments

anthonyettinger picture anthonyettinger  路  3Comments

yvan-sraka picture yvan-sraka  路  3Comments

daenuprobst picture daenuprobst  路  3Comments