浏览代码

[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 年之前
父节点
当前提交
fb2f405db4
共有 1 个文件被更改,包括 7 次插入4 次删除
  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"