-
-
Notifications
You must be signed in to change notification settings - Fork 289
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
Faliures when running arkade update
on windows
#977
Comments
Removed the part about the wrong binary being downloaded. Was testing in conemu instead of git-bash, which works. |
Does |
For Windows, we could probably look at os.Executable() to see if it has an extension of .exe over here: https://github.com/alexellis/arkade/blob/master/pkg/env/env.go#L17 That would make it work a little better in standard cmd.exe prompt. Checking runtime.GOOS would probably also work and give back something like "Windows" |
While debugging I get the following:
Which makes me believe quite strongly that it does not support uname, hehe. Checking runtime.GOOS might work to get the OS for sure, but to future proof it I'd as well check the GOARCH to throw an error on aarch64 windows builds (which is not yet common, but hopefully will be in the future) :) Is the |
We talked about this with @JanDeDobbeleer ... and I think GOOS/GOARCH might be fine for Windows. Windows Arm64 isn't in scope for arkade at all at the moment.
arkade is only tested with bash, that's one of the reasons. If the above was sorted out, we'd need to look at other places where we execute binaries and see if cmd.exe could be supported. |
From my testing it is possible to rename, but not remove, the exe, so could name it .arkade.exe.old or similar and remove it at startup or with another command, that way, Arkade could execute the new binary and close, where the new binary does the cleanup. |
@Johannestegner I like both of those ideas. Can you send a PR for the simpler variant for GOOS=windows? |
I might have some issues creating the PR today, so if someone want's to do it quicker it's totally okay, else I'll try to get it done tomorrow (contract work + birthday will take up this day). |
Thanks for working on this @Johannestegner. I'll keep an eye out for a PR. |
Seeing uname -m/-s returns quite different values than I feel that this is quite a vital function for the application, so considering to first write a test for it. But, testing the Would it be preferable if I made two internal functions, say:
Which are then used in There are very few test cases in the application, so I kind of wonder if it's even something that is wanted or if I rather should just test the binary on multiple platforms (I have linux amd/arm64/armhf, windows and mac intel/aarch64 available for testing if that is the case). |
"Very few" - there are 156 unit tests 😢 Just go ahead and write the code how you think it should work, don't over think it and I'll see if it makes sense to add any tests during the review - once it's working on Windows, macOS and Linux. GetClientArch doesn't sound like something should be tested. |
Not sure why I wrote "very few in the application", that was bad of me, there are actually more than I initially saw :P The reason I want tests is due to the fact that uname -s and uname -m returns a tad different values than the runtime package reports, eg |
Hope you had a good birthday. Send a PR for how you think it should work, and I'll advise on whether I think additional automated tests are required. How does that sound? |
Sorry for taking some time to do this, been really busy with ongoing contract. So, by using the runtime package, it seems like most ARCHs and OS:es should work right out of the box with the current implementation. That is, just updating the GetClientArch() function with the following:
But, the issue that I have is for With the above code, the
If so, I can create a PR with that change right away, but I fear that it might be a bit to naïve, hehe. |
Tested with above code on: Darwin (intel) It seems like the |
The following half-ugly snippet does work though:
Tested on: Darwin (intel) Windows currently returns "Error: update is not supported on Windows at this time", which is expected, but it also show that windows is resolved correctly in the application, which is positive! Now, I'm not super happy with the code, the |
Expected Behaviour
Clean update without any issues when running
arkade update
on windows.Current Behaviour
The
replaceExec
function fails due to not being able to replace the file (it's in use), I have a potential solution to this.Possible Solution
The issue seems to be possible to partially fix by not "defering" the close calls on the stream. Basically just moving the closes down and not defer, as the file have to be closed to be replaced.
Further, it seems like the original file needs to be renamed rather than replaced, and I can't figure out how to remove it after (seeing the process is running and hence locking the binary).
This could be done by just moving it to an
.arkade.exe.old
file and remove at another stage or next time the binary is updated. OR there is a solution which I have yet to figure out :)Steps to Reproduce (for bugs)
Your Environment
Using windows 10, currently cmder/conemu while the same issue exist in git bash.
0.10.9 (or rather the master branch while testing).
The text was updated successfully, but these errors were encountered: