Hyper: "Open Hyper here" with shell zsh is not working

Created on 16 Dec 2016  路  9Comments  路  Source: vercel/hyper

  • [X] I am on the latest Hyper.app version
  • [X] I have searched the issues of this repo and believe that this is not a duplicate

  • OS version and name: Windows 10

  • Hyper.app version: 1.0.0
  • Link of a Gist with the contents of your .hyper.js: https://gist.github.com/con-ssc/26cd65a2888cf26953a801e0799a9ae4
  • Relevent information from devtools _(CMD+SHIFT+I on Mac OS, CTRL+SHIFT+I elsewhere)_: no errors
  • The issue is reproducible in vanilla Hyper.app: Yes

Issue

"Open Hyper here" only works for certain shells. I try to use zsh and I cannot get this to work with the context menu.

Guide

Most helpful comment

If your on Windows using Hyper with Zsh through Cygwin and "Open Hyper Here" isn't working properly, it may be due to a function in cygwin64/etc/profile that unless invoked by CHERE, will start zsh in the users $Home directory instead of the cwd [current working directory] as originaly intended by the "Open Hyper Here" context menu functionality.

To fix this, you need to specify CHERE_INVOKING: 1 in your hyper.js config file under the environmental variables section, e.g:

// for environment variables
    env: {
      CHERE_INVOKING: 1  // Fix for "Open Hyper Here" with zsh / cygwin / hyper on windows
         },

Big Thanks to @schmic for posting this hyper.js config which helped me figure out where to add the variable to invoke CHERE.

All 9 comments

I have the same issue with bash on windows.
With the default windows shell, hyper starts where I want it to, using
shell: 'C:\\msys64\\usr\\bin\\bash.exe'
in .hyper.js always opens the shell in my home directory (under C:\msys64).

There is another, probably related issue.
My bash (from msys64, as above) is started with a near-empty PATH.

$ echo $PATH
/usr/local/bin:/usr/bin:/bin:/opt/bin:/c/Windows/System32:/c/Windows:/c/Windows/System32/Wbem:/c/Windows/System32/WindowsPowerShell/v1.0/:/usr/bin/site_perl:/usr/bin/vendor_perl:/u
sr/bin/core_perl

Notably, the only paths pointing outside of / (which is c:\msys64 ) are /c/Windows/System32:/c/Windows:/c/Windows/System32/Wbem:/c/Windows/System32/WindowsPowerShell/v1.0/, which is missing most of my system PATH and all my user PATH.

As a workaround, I found that running bash inside the default windows shell (by passing it as a command to be run) adresses the issues mentioned above.
C:\WINDOWS\system32\cmd.exe /K C:\msys64\usr\bin\bash.exe
In .hyper.js:

//shell: 'C:\\msys64\\usr\\bin\\bash.exe',
//shell: 'C:\\WINDOWS\\system32\\cmd.exe', //this is the default windows shell
shellArgs: ['/K C:\\msys64\\usr\\bin\\bash.exe'],

The thing is packages like MSYS and CYGWIN use POSIX style paths and may even have different home directories and don't recognize the path given in Windows-style :cry:

MSYS bash recognizes the PATH just fine if called from a cmd.exe-shell rather than being invoked directly by hyper.

I don't know what mature Windows shells like Cmder (or the underlying ConEmu) do to avoid or address this, but Cmder at least does not exhibit the issues described above. Maybe they found a workaround, or they might be using a different way to invoke the shell than whatever is used by npm/pty.js, which hyper uses.

If your on Windows using Hyper with Zsh through Cygwin and "Open Hyper Here" isn't working properly, it may be due to a function in cygwin64/etc/profile that unless invoked by CHERE, will start zsh in the users $Home directory instead of the cwd [current working directory] as originaly intended by the "Open Hyper Here" context menu functionality.

To fix this, you need to specify CHERE_INVOKING: 1 in your hyper.js config file under the environmental variables section, e.g:

// for environment variables
    env: {
      CHERE_INVOKING: 1  // Fix for "Open Hyper Here" with zsh / cygwin / hyper on windows
         },

Big Thanks to @schmic for posting this hyper.js config which helped me figure out where to add the variable to invoke CHERE.

I fixed this by changing C:\\Windows\\System32\\bash.exe to C:\\WINDOWS\\System32\\bash.exe

CHERE_INVOKING: 1 works everywhere except when Explorer is on drive letters.
E.g. it works for C:\Windows or D:\Video, but don't work for just C:\, D:\, etc (it opens $HOME).

I am using Hyper 3.0.2 (stable)

shell: 'C:\\Program Files\\Git\\bin\\bash.exe'
shellArgs: ['--login']

CHERE_INVOKING: 1 works everywhere except when Explorer is on drive letters.
E.g. it works for C:\Windows or D:\Video, but don't work for just C:\, D:\, etc (it opens $HOME).

I am using Hyper 3.0.2 (stable)

shell: 'C:\\Program Files\\Git\\bin\\bash.exe'
shellArgs: ['--login']

Same problem. In my hyper.js it's written:

 shell: 'C:\\Program Files\\Git\\git-cmd.exe',
// for setting shell arguments (i.e. for using interactive shellArgs: ['-i'])
// by default ['--login'] will be used
shellArgs: ['--command=usr/bin/bash.exe', '-l', '-i'],
Was this page helpful?
0 / 5 - 0 ratings

Related issues

legomushroom picture legomushroom  路  3Comments

weabot picture weabot  路  3Comments

dbkaplun picture dbkaplun  路  3Comments

leo picture leo  路  3Comments

rauchg picture rauchg  路  3Comments