Setting Powershell as default terminal for Windows 10+ (fixes #16838)#18493
Conversation
Tyriar
left a comment
There was a problem hiding this comment.
Just a few comments, I restarted the Travis build as it looked like it was flaky.
There was a problem hiding this comment.
I think sysnative/ should be used on 64 bit machines? Please confirm @daviwil
There was a problem hiding this comment.
That is correct. Since VS Code is a 32-bit process, the 64-bit version of PowerShell has to be explicitly launched otherwise you'll get the 32-bit version. Here's the relevant code from the PowerShell extension:
There was a problem hiding this comment.
I think you'd be better off getting the major version here as os.release() may return x.y.z?
Something like this should be safe (if Node does indeed give that format):
parseInt(os.release().split('.')[0], 10) >= 10There was a problem hiding this comment.
I'm not sure if it's necessary, since I'm parsing it to a float. That means 10.2.22222 and 11.4.4444 will still be >= 10 (and 9.5.555 will not).
I'm happy to take the change - let me know what you want to do.
There was a problem hiding this comment.
I think it would be best to be explicit here, parseFloat('10.2.22222') may work but it feelss dodgy to me and the behavior itself may even be undefined and only works by coincidence.
|
Thanks for sending this out, @jchadwick! |
… 32-bit Easter egg: this commit was done via the VSCode PS shell!
33cb4c7 to
74aee4a
Compare
|
@Tyriar I think that I incorporated all your feedback. Not sure what's going on with the Travis build, but I think I'm all good here. |
| import processes = require('vs/base/node/processes'); | ||
|
|
||
| const powerShellExePath = | ||
| !process.env.hasOwnProperty('PROCESSOR_ARCHITEW6432') |
There was a problem hiding this comment.
@daviwil so this is an env variable only available on 64 bit Windows? Would it be better to check process.arch instead?
There was a problem hiding this comment.
I dunno, I just copied from the PowerShell extension. :-D
process.arch probably makes more sense anyway. I'll change it.
There was a problem hiding this comment.
Actually, now that I'm playing around with it, process.arch is going to give you 32-bit. I think that code that I stole from @daviwil is probably the right way to do it.
There was a problem hiding this comment.
Yep, that's what I had to use to figure out the true bitness of the OS.
|
Great, thanks @jchadwick 😄 |
Resolves #16838