Skip to content

WSL CLI Fix [#4998] - #8863

Merged
niik merged 7 commits into
desktop:developmentfrom
shawnfunke:wsl-cli-fix
Jun 15, 2020
Merged

niik merged 7 commits into
desktop:developmentfrom
shawnfunke:wsl-cli-fix

Conversation

@shawnfunke

Copy link
Copy Markdown
Contributor

Closes #4998

Description

This PR fixes issue #4998

Release notes

Notes:

  • Fixed not being able to run the github command from the WSL CLI

@shawnfunke
shawnfunke requested a review from joshaber January 14, 2020 21:44
@shawnfunke
shawnfunke requested a review from shiftkey January 25, 2020 21:26
@shawnfunke

Copy link
Copy Markdown
Contributor Author

@shiftkey Any news on this?

@shiftkey

Copy link
Copy Markdown
Member

@shawnfunke I'm no longer working on GitHub Desktop. Providing more context about what the fix is and how to verify the fix locally could help with getting someone to work on it.

@shawnfunke

Copy link
Copy Markdown
Contributor Author

I've looked at the worked you've started and pretty much just finished it. I've tested this with Git Bash, Debian WSL, CMD and PowerShell on my local machine.

@dennisameling

Copy link
Copy Markdown
Contributor

@shawnfunke would you mind rebasing this PR on the upstream development branch? There's been some pretty significant dependency updates (e.g. Electron v5 to v7 upgrade). Would be happy to test this PR on WSL then :)

@shawnfunke

Copy link
Copy Markdown
Contributor Author

@dennisameling sure, i'll rebase and test this :)

@shawnfunke
shawnfunke dismissed a stale review via a7ed775 April 13, 2020 15:55
@shawnfunke

Copy link
Copy Markdown
Contributor Author

@dennisameling I've rebased my by branch but after trying for hours I'm not able to test it. I'm always getting the error below when trying to build the project, are you able to test it? It could be because I'm not running the latest stable Windows 10 release.

[Error: ENOENT: no such file or directory, rename 'C:\shfk\desktop\dist\GitHubDesktop-dev-win32-x64\electron.exe' -> 'C:\shfk\desktop\dist\GitHubDesktop-dev-win32-x64\GitHubDesktop-dev.exe'] {
  errno: -4058,
  code: 'ENOENT',
  syscall: 'rename',
  path: 'C:\\shfk\\desktop\\dist\\GitHubDesktop-dev-win32-x64\\electron.exe',
  dest: 'C:\\shfk\\desktop\\dist\\GitHubDesktop-dev-win32-x64\\GitHubDesktop-dev.exe'
}

@dennisameling

dennisameling commented Apr 13, 2020 •

Copy link
Copy Markdown
Contributor

@shawnfunke I can't seem to build desktop with npm run build:prod (might be a temporary problem with the development branch):

[WEBPACK] Finished building highlighter.js within 53.054 seconds
i 「atl」: Checking started in a separate process...
× 「atl」: Checking finished with 1 errors
[WEBPACK] Build failed after 70.296 seconds
[WEBPACK] Errors building ask-pass.js
[at-loader] ./app/src/lib/git/core.ts:372:22
    TS2339: Property 'TagAlreadyExists' does not exist on type 'typeof GitError'.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @ build:prod: `yarn compile:prod && cross-env NODE_ENV=production ts-node -P script/tsconfig.json script/build.ts`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @ build:prod script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\denni\AppData\Roaming\npm-cache\_logs\2020-04-13T20_13_59_734Z-debug.log

Maybe it's related to the error you're seeing? Maybe better to rebase based on the latest release version (https://github.com/desktop/desktop/releases/tag/release-2.4.0) which is from 20 days ago. This version was updated to Electron 7 so the major dependency upgrade is done in it. You should be able to rebase based on a certain tag (release-2.4.0): https://stackoverflow.com/a/12469904/4337765

@shawnfunke

Copy link
Copy Markdown
Contributor Author

@dennisameling not sure, it's weird that the CI builds were successful. I will try to rebase it with the tag tomorrow and try that instead.

@shiftkey

Copy link
Copy Markdown
Member

@dennisameling ensure you have done a yarn to sync your installed dependencies because that error is related to a new version of dugite that was merged recently - #9461

@dennisameling

dennisameling commented Apr 14, 2020 •

Copy link
Copy Markdown
Contributor

Got it to work now, had to completely remove node_modules and app/node_modules prior to running yarn to ensure a clean state. Thanks for the heads-up @shiftkey, will go ahead and test now

@dennisameling dennisameling left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✔️ launches successfully on Windows cmd
✔️ launches successfully in Windows WSL2 command line (Ubuntu)
✔️ launches successfully in Git Bash on Windows

Thanks so far for this PR!! 😄

Comment thread app/static/win32/github.sh Outdated
"$ELECTRON" "$@"
exit $?
fi
elif [ "$(expr substr $(uname -s) 1 9)" == "CYGWIN_NT" ]; then

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please change == to = as it causes the following message in WSL2 (Ubuntu):

dennis@DESKTOP-HIGHLVU:/mnt/c/Users/denni$ github
/mnt/c/Users/denni/AppData/Local/GitHubDesktop/bin/../app-2.4.1-beta1/resources/app/static/github.sh: 20: [: Linux: unexpected operator

When I changed it to = as per these instructions, I didn't get the warning anymore.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done! :)

dennisameling
dennisameling previously approved these changes Apr 14, 2020

@dennisameling dennisameling left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works as expected. Thanks @shawnfunke!!

✔️ launches successfully on Windows cmd
✔️ launches successfully in Windows WSL2 command line (Ubuntu)
✔️ launches successfully in Git Bash on Windows

@shawnfunke

Copy link
Copy Markdown
Contributor Author

@dennisameling Hey, is this supposed to be already merged or are we waiting for a specific release to drop?

@dennisameling

Copy link
Copy Markdown
Contributor

@shawnfunke I'm not a member of the GitHub Desktop repository 😊 The only thing I can do is to help test PRs so that it's easier for the core team to verify and merge them. Let's hope they will merge this fix soon!

@shawnfunke

Copy link
Copy Markdown
Contributor Author

@dennisameling Ah, okay thanks for the insight :)

@niik niik left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @shawnfunke, thanks so much for working on this! I'm terribly sorry it's taken so long for us to do a review of this. We're working through a long backlog of community contributions and unfortunately none of us are experts at WSL.

A huge thanks to @dennisameling for testing this PR and ushering it along ❤️ We really appreciate it.

I've added some requests for changes in the PR but I wanted to make sure I understood the problem fully. I took a look at the github.sh trampoline file that's currently on my Windows VM and it looked something like this

image

If I've understood things what we want is for it to use a POSIX path instead, something like this

image

Is that correct?

@niik niik self-assigned this Jun 12, 2020
@shawnfunke

Copy link
Copy Markdown
Contributor Author

@niik , yes you understood it correctly. Thanks for your review, I agree with your suggestions and I will go ahead and add them to this PR!

These suggestions shorten and simplify the code

Co-authored-by: Markus Olsson <[email protected]>

@niik niik left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work @shawnfunke and @dennisameling. I verified the fix with a test release and confirmed that the bin/github trampoline path only used forward slashes

image

I wasn't able to verify this in WSL since I don't have that available but given that the original fix was verified in WSL by @dennisameling and that the subsequent changes were only cleanup that didn't affect the logic I'm happy to merge this.

@niik
niik merged commit 5d956d5 into desktop:development Jun 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fail to start from WSL

4 participants