Is the issue that people are hitting initially installing on windows or general behaviour of the clj command?
Keen to bring clj
to everyone, but am curious why there is no release yet. I have been lucky and had no problems, what should be done to move clj
to windows without snaring the unsuspecting.
If it stays as a PowerShell module, Id still like to see it distributed on PS Gallery so that it's just an Install-Module command to get it installed. Would remove me some of the oddities of the script prompting for locations, etc.
So, zero configuration install, rather than the third degree?
Yeah, with Install-Module the default is to install at the system level, which requires admin, but you can provide "-Scope CurrentUser" to install it in the user module directory. But that would be the user making the choice at the time they install. I think we'd run into fewer execution policy problems that way to.
However, that doesn't address some of these concerns about using from other shells.
Ah, are people trying to run it from WPL too? :)
WSL?
In that case you can use the linux install
But @miridius mentioned cmd.exe, Git bash, Cmder
Point. That should just work.
So cmd.exe and git bash I know, will have to look at cmder since I haven't used that.
I think cmder is just wrapping other shells, so I don't think it adds any new wrinkles to this.
So the issue is it isn't working in these envs and an 'uberinstall' is needed to cover them all?
The issue is that a PowerShell module doesn't add commands to the PATH, where other shells would look for them
The nice part (from my perspective) is that you don't have to mess with people's PATH variable
Since it's not like Linux where you drop the binary in /usr/bin or something like that
Then again, adding to the PATH variable is a common Windows thing.
Yeah, that part confuses me. Windows by convention doesn't have a common binary path, why can't it just install to \Programs\Clojure and add that to the PATH? Everything else does, and powershell can do this...
Certainly can. That's closer to how it worked when I started working on my contributions.
The PowerShell module approach cleans some aspects of the code up. But can still be combined with adding things to the PATH
If we could just "force" everyone to use PowerShell on Windows, we could solve this easily 🙂
I guess I am just confused. clj
is working fine for me. I don't understand the politics that is pushing against a release ;)
Sounds good to me @seancorfield
Naturally a .bat could be shipped with a standard installer and a zip for those who want more control
I think getting it into the PS Gallery would address a lot of the current glitches folks are running into -- and I don't see that as being much different to having the Mac installers go into brew
.
The only other integration point is editors: and I think that would require them all getting on board with having to invoke it via the powershell
command, right?
I think so
To be honest, I think the alternate shell issue is a red herring. Do the PS install as a one-off and then just use powershell clj -A:rebl-8
or whatever from cmd
and you're up and running.
(I'm still very excited that I can run REBL on Windows that easily!)
That's a good point on the other shells. Hadn't thought about that.
The funny thing is, until recently I didn't understand enough powershell escaping to launch lein from powershell effectively. Mostly because I needed to escape --
. It was never clear to me reading the official manual, so I can understand why tools may have issues with that, especially if the devs aren't familiar with the platform
As part of the updates for clj, I learned that --% is a shortcut for terminating powershells normal parsing
So you could do lein --% --my-normal-args
However, that might not be any better than remembering to quote things
What was nice with clj is its client's syntax is remarkably compatible across ps, sh and cmd
Is there a nice, simple way to update the PowerShell clj
version to the latest release? Or is that something that will really only come once it's up on somewhere standard like PS Gallery?
I don't think there is in the current one
With PSGallery, it would be Update-Module
Good point. Personally I use chocolatey for reasonable package management under Windows
Yeah, chocolatey's alright. PSGallery wouldn't require an additional install (chocolatey itself) to work though. PowerShell comes with the PSGallery repo registered by default
I mean.. clojure-tools.jar
could do the check and even replace it's jar under Windows. One of the nice things about not being an exe is windows doesn't lock you out when it is executing because sun thought of that ;)
On Windows you can't replace a JAR file that's on the classpath of a running JVM
Ahh. You definitely used to be able to. :(
Something about Oracle.
You might be able to move the JAR and then put the new one in it's place, but pretty sure you can't delete/overwrite the file.
Yeah you could probably do that. Though you would probably need to delete yourself if you aren't System
That said, it was possible to write out a new Exe, execute it, and have it delete the parent years ago. Though following in malware's footsteps is probably not a great idea.
I'd still vote for PSGallery and "embracing the host" and it's install/update process. 😉
Don't think that particular 'feature' is an intentional security boundary though... UAC isn't officially I recently learned 😭
Not following. Isn't officially what?
A boundary in the operating system designed to protect security bypass
There are many unpatched UAC bypasses in windows. The official position is "we don't care" :/
Interesting
https://github.com/hfiref0x/UACME/blob/master/README.md "yaay"
Anyway, that is massively OT, sorry.
But yeah, it would be possible for the .jar itself to implement an update
command which downloaded the new jar to temp, then launched it and killed itself, such that the new jar could overwrite it
Well it may not just be JAR updates. I'm not going to pretend there aren't bugs in the .psm1 file after I touched it. 😁
All the more reason to leverage an update process that's outside of the clj tooling. (Whether PSGallery or Chocolatey)
:D me either. I also guess that also cmd users could be catered for?
Tell them to run powershell clj
. Seriously.
Other than my own ignorance, powershell hasn't failed me so far
Even for the install process, in cmd you can just type powershell
and you're in PS. Type the single install-from-PS-Gallery command, then exit
and you're back in cmd and you're done.
(in fact, you could probably just do powershell Install-Module ...
directly from cmd right?)
Never tried it
But yeah for install, definitely not a big deal to ask people to open a PS window
And prefixing with powershell isn't that bad either for the other commands.
I think you can pass a flag to put you there if it doesn't do it intitially
And I refuse to believe a bat would be hard to produce, although I was surprised how much work clj.ps1 does
Try to write a .bat
for it. I wouldn't want to tackle that! 🙂
Reasonable work, but no intuitive nontheless
Agreed (with sean)
Haha. You could always drop to vbs :)
@ajoberstar how do you pass an argument to Install-Module
to scope it to the current user? (I'm just poking around at it here)
Install-Module -Name Whatever -Scope CurrentUser
Ah, that was my problem -- I was trying to mix argument styles.
Main issue is potentially nasty escaping passed from .bat to .ps in pathological cases, but again, clj avoids a lot of this silliness
So the answer is "Yes, you can invoke the PS installer via a single command from cmd"
(assuming you're trying to install something it knows about rather than a local custom module)
So remaining hurdle would just be how does publishign to PS Gallery work from Cognitect's perspective and CI infrastructure
"we believe..." let's have a working example, but it seems totally feasible
The publishing I've done to it has been from my desktop/laptop
pulling out of the thread and back to here...
there are clearly different technical options
someone needs to make a table that lists the options. and define some dimensions on which there are tradeoffs, and describe those tradeoffs
without that, we are all just talking, not making a technical decision
there is at least one technical question buried in there too about update - can you update the jar and/or script while clj is running (I think that's unlikely, but someone should actually test it)
as far as how to get "built thing" to "deployed somewhere", that's the easy part. the hard part is determining what the thing is in the first place.