hyper icon indicating copy to clipboard operation
hyper copied to clipboard

"Open Hyper here" with shell zsh is not working

Open ghost opened this issue 9 years ago • 9 comments

  • [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.

ghost avatar Dec 16 '16 11:12 ghost

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).

Waquo avatar Dec 19 '16 23:12 Waquo

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.

Waquo avatar Dec 20 '16 00:12 Waquo

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'],

Waquo avatar Dec 20 '16 01:12 Waquo

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:

Specro avatar Dec 20 '16 07:12 Specro

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.

Waquo avatar Dec 20 '16 13:12 Waquo

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.

meta-state avatar Jul 22 '17 03:07 meta-state

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

pariola avatar May 16 '18 19:05 pariola

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']

mishka88ru avatar May 16 '19 16:05 mishka88ru

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'],

hridoy100 avatar May 08 '20 00:05 hridoy100