Skip to content

Fix issue with upgrading on Windows#646

Merged
nywilken merged 1 commit intoexercism:masterfrom
nywilken:windows-upgrade-fix
Jul 17, 2018
Merged

Fix issue with upgrading on Windows#646
nywilken merged 1 commit intoexercism:masterfrom
nywilken:windows-upgrade-fix

Conversation

@nywilken
Copy link
Copy Markdown
Contributor

This changes ensures that the upgrade process does not try to replace
the exercism binary with a non executable file. There is probably a more
extensive check we can do to ensure we have the correct file. I did not
choose to use the full name as Configlet is also using the cli pkg for
upgrading its binary.

closes #645

This changes ensures that the upgrade process does not try to replace
the exercism binary with a non executable file. There is probably a more
extensive check we can do to ensure we have the correct file. I did not
choose to use the full name as Configlet is also using the cli pkg for
upgrading its binary.
@nywilken nywilken requested a review from kytrinyx July 16, 2018 04:17

for _, f := range zr.File {
info := f.FileInfo()
if info.IsDir() || !strings.HasSuffix(f.Name, ".exe") {
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.

Why iterating over all files?

Why not just extract exercism.exe?

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.

Why iterating over all files?

I don't want to assume that the first file is the executable, even though that is probably the case.

Why not just extract exercism.exe?

If I extract the whole zip I would have to create the structure locally, then write each of the files. I am essentially extracting the executable without writing the file to disk (less to clean up). I could check for the exact name, read it's contents, then return in case we decide to add more binaries to the release package.

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.

Makes totally sense, thanks for the explanation.

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.

Anytime! Thanks for the question and review.

Copy link
Copy Markdown
Member

@kytrinyx kytrinyx left a comment

Choose a reason for hiding this comment

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

This looks good. I'll cut a new release once you've merged this.

@nywilken
Copy link
Copy Markdown
Contributor Author

nywilken commented Jul 17, 2018

@kytrinyx I realized that we are not closing the zip or the file after reading their contents. I want to add that in before merging. Disregard, I see the close being called further upstream.

For future reference, am I okay to cut releases again? During the mentorcism releases I think you were doing something custom. But now it should be a standard release, right?

@nywilken nywilken merged commit 62df39d into exercism:master Jul 17, 2018
@nywilken nywilken deleted the windows-upgrade-fix branch July 17, 2018 02:41
@kytrinyx
Copy link
Copy Markdown
Member

For future reference, am I okay to cut releases again? During the mentorcism releases I think you were doing something custom. But now it should be a standard release, right?

Yes! You're good to cut releases.

For mentorcism I was changing the default base URL and then calling NAME=mentorcism bin/build-all -- so just a little bit hacky.

@nywilken
Copy link
Copy Markdown
Contributor Author

Thanks for cutting the release and info on mentorcism. If the situation araises again I cut any neccessary releases to help get fixes out and lighten your load 😉

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.

Windows 10: Resulting CLI after upgrade broken

3 participants