Skip to content
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

vscode-powershell / scripts / Install-VSCode.ps1 $IsLinux failure #996

Closed
codykonior opened this issue Aug 15, 2017 · 7 comments · Fixed by #1235
Closed

vscode-powershell / scripts / Install-VSCode.ps1 $IsLinux failure #996

codykonior opened this issue Aug 15, 2017 · 7 comments · Fixed by #1235
Labels
Hackathon Up for grabs, especially at Hackathons! Up for Grabs Will shepherd PRs.

Comments

@codykonior
Copy link

System Details

  • Operating system name and version: Server 2012 R2
  • VS Code version: None
  • PowerShell extension version: None
  • Output from $PSVersionTable: Name Value

PSVersion 5.1.14409.1012
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.14409.1012
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1

Issue Description

Installing using the script:

PS C:\Users\XXX> Install-Script Install-VSCode -Scope CurrentUser; Install-VSCode.ps1

C:\Users\XXX\Documents\WindowsPowerShell\Scripts\Install-VSCode.ps1 : The variable '$IsLinux' cannot be retrieved because it has not been set.
At line:1 char:51

  • Install-Script Install-VSCode -Scope CurrentUser; Install-VSCode.ps1
  •                                               ~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : InvalidOperation: (IsLinux:String) [Install-VSCode.ps1], RuntimeException
    • FullyQualifiedErrorId : VariableIsUndefined,Install-VSCode.ps1

This is because StrictMode is on, and you're checking a variable that doesn't exist. It's best practice to do checking of variables in a way that doesn't trigger errors.

@daviwil daviwil modified the milestone: 1.4.2 Aug 24, 2017
@daviwil daviwil modified the milestones: September 2017, 1.4.2 Sep 5, 2017
@daviwil daviwil modified the milestones: September 2017, Future Oct 26, 2017
@TylerLeonhardt TylerLeonhardt added the Hackathon Up for grabs, especially at Hackathons! label Feb 21, 2018
@TylerLeonhardt
Copy link
Member

TylerLeonhardt commented Feb 23, 2018

This check for $IsLinux in a "truthy" way should be changed to:

Test-Path variable:IsLinux

@TylerLeonhardt TylerLeonhardt added the Up for Grabs Will shepherd PRs. label Mar 20, 2018
@michaelschulz
Copy link

$IsLinux is available in PS 6. The sript itself (at this point) doesn't support installation on Linux, so what's the point of switching the $Architecture to either 64-bit or 32-bit if an OS that's not supported by this script is detected?

@dsolodow
Copy link
Contributor

dsolodow commented Mar 21, 2018

It doesn't; it only does that check if the OS is Windows.
Did you perhaps miss the ! in if (!($IsLinux -or $IsOSX)) ?
It would have been more readable to make it if (-not($IsLinux -or $IsOSX))

@michaelschulz
Copy link

No, I did see the !. What I was wondering was why even check for that if there's no support to install on anything but Windows? Looking into a way to implement for Linux.

@dsolodow
Copy link
Contributor

dsolodow commented Mar 21, 2018 via email

@michaelschulz
Copy link

Correct, plus a decision whether to do a direct install from package or add repo and then install from there which would probably be the preferred way in order to keep the system up to date.

@TylerLeonhardt
Copy link
Member

If folks use a certain distro of linux, they're more than welcome to submit a PR with an automated installation for that distro 😃 same goes for macOS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Hackathon Up for grabs, especially at Hackathons! Up for Grabs Will shepherd PRs.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants