Skip to content

Use correct executable name depending on OS #4269 #4273

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

KnapSac
Copy link

@KnapSac KnapSac commented Feb 15, 2025

  • PR Description
    Use correct executable name depending on OS.

When unzipping the new version, we were always extracting lazygit. On Windows, the executable is named lazygit.exe. This PR fixes that issue.

  • Please check if the PR fulfills these requirements
  • Cheatsheets are up-to-date (run go generate ./...)
  • Code has been formatted (see here)
  • Tests have been added/updated (see here for the integration test guide)
  • Text is internationalised (see here)
  • If a new UserConfig entry was added, make sure it can be hot-reloaded (see here)
  • Docs have been updated if necessary
  • You've read through your own file changes for silly mistakes etc

I'm not really sure how to test this (and as far as I can tell there are no integration tests for this feature yet). When attempting to use the feature from a version started using go run main.go it fails when trying to replace the current executable. I'm unsure whether this is due to something go run does, or whether that is Windows specific behavior. If I remember correctly, on Windows you can't replace the current executable, so perhaps that needs dedicated support on Windows.

Fixes #4269

@KnapSac
Copy link
Author

KnapSac commented May 1, 2025

Is there something I can do to get this PR merged?

@jesseduffield
Copy link
Owner

@KnapSac I'm okay for no test given it requires network requests and so on.

@ChrisMcD1 As a windows user, any chance you'd be able to locally test if this works?

@ChrisMcD1
Copy link
Contributor

@jesseduffield Ran the code locally, and it's certainly better!

Although it moves me from a file named error
image
to
image

The latter could 100% be user-error on my part. Although I am a windows user, I spend most of my time in WSL these days 😆

@KnapSac
Copy link
Author

KnapSac commented May 2, 2025

I believe that's due to the issue I mentioned, where Windows isn't able to replace the currently running executable. We'd need something like https://github.com/mitsuhiko/self-replace (but for Go), or replicate the behavior ourselves.

I don't know if there is a comparable library for Go, as this PR contains the first lines of Go I've ever written, but that would be the easiest.

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.

Update fails on Windows
3 participants