Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

Nothing displayed on Windows with Cygwin #74

Open
codehearts opened this issue Mar 29, 2018 · 3 comments
Open

Nothing displayed on Windows with Cygwin #74

codehearts opened this issue Mar 29, 2018 · 3 comments

Comments

@codehearts
Copy link

codehearts commented Mar 29, 2018

I'm on 64bit Windows 7 with cygwin32, Git Bash, and Hyper 1.4.8. The statusline shows nothing until I run a command like git status with unstaged changes, then it shows the first path in the output as my cwd with no Git info.

I actually found a workaround for this, by replacing the logic for win32 in setCwd with the following

if (process.platform == 'win32') {
    // lsof isn't present, but /proc/${pid}/cwd is
    exec(`readlink -e /proc/${pid}/cwd`, (err, stdout) => {
      // Convert Cygwin path to Windows path for Git Bash
      exec(`cygpath -w ${stdout}`, (err, stdout) => {
        cwd = stdout.trim();
        setGit(cwd);
      })
    });
}

While this works for cygwin with Git Bash installed separately, I'm not sure if this works for Cygwin using Cygwin's Git, or if it would work for Git Bash/MinGW. I'm also not sure how you could detect Cygwin or other setups from the plugin.

@pevecyan
Copy link
Contributor

An option is to have fallback, which triggers if previous method does not return correct path.
For example, default is as is now and if that fails your code gets executed.

@codehearts
Copy link
Author

If the last command prints a path name (git status), then the existing code thinks that path is the cwd and the fallback won't run. Otherwise that would work.

On top of that, cygpath needs to be run if using Git for Windows, but not if Git was installed through Cygwin 😩 You can at least tell if it's Git for Windows by checking if git --version contains "windows" (git version 2.16.1.windows.1)

I can try to get a PR together that checks these conditions, the code in my original post is too specific to my setup.

LikeSundayLikeRain pushed a commit to LikeSundayLikeRain/hyper-statusline that referenced this issue May 31, 2019
@jerriclynsjohn
Copy link

This works only problem is that when I cd out of the repository the statusline still shows the same branch with the all the git numbers from the previous repo, even if you cd into another repo,

This works if you directly open hyper from the respective repo, Is there anyone who has solved this.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants