Bläddra i källkod

[Bugfix]: added -ScriptBlock to run commands ```install.ps1``` (#2188)

* fix(installer): use script-block to run commands

* fix(installer): enforce v7 as erroraction break is not supported in v5
Adrian Nadau Semb 3 år sedan
förälder
incheckning
fb2f405db4
1 ändrade filer med 7 tillägg och 4 borttagningar
  1. 7 4
      utils/installer/install.ps1

+ 7 - 4
utils/installer/install.ps1

@@ -1,3 +1,4 @@
+#Requires -Version 7.1
 $ErrorActionPreference = "Stop" # exit when command fails
 
 # set script variables
@@ -139,9 +140,10 @@ function check_system_deps() {
 }
 
 function install_nodejs_deps() {
+    $dep = "node"
     try {
-        check_system_dep "node"
-        Invoke-Command npm install -g neovim tree-sitter-cli -ErrorAction Break
+        check_system_dep "$dep"
+        Invoke-Command -ScriptBlock { npm install --global neovim tree-sitter-cli } -ErrorAction Break
     }
     catch {
         print_missing_dep_msg "$dep"
@@ -149,9 +151,10 @@ function install_nodejs_deps() {
 }
 
 function install_python_deps() {
+    $dep = "pip"
     try {
-        check_system_dep "pip"
-        Invoke-Command python -m pip install --user pynvim -ErrorAction Break
+        check_system_dep "$dep"
+        Invoke-Command -ScriptBlock { python -m pip install --user pynvim } -ErrorAction Break
     }
     catch {
         print_missing_dep_msg "$dep"