@@ -46,13 +46,9 @@ function check_slack_binary_exist() {
4646 )
4747 $FINGERPRINT = " d41d8cd98f00b204e9800998ecf8427e"
4848 $SLACK_CLI_NAME = " slack"
49- Write-Host " xd1: $alias "
50- Write-Host " xd2: $Alias "
5149 if ($alias ) {
5250 $SLACK_CLI_NAME = $alias
5351 }
54- Write-Host " xd3: $SLACK_CLI_NAME "
55- # & $SLACK_CLI_NAME _fingerprint
5652 if (Get-Command $SLACK_CLI_NAME - ErrorAction SilentlyContinue) {
5753 if ($Diagnostics ) {
5854 delay 0.3 " Checking if `` $SLACK_CLI_NAME `` already exists on this system..."
@@ -164,19 +160,17 @@ function install_slack_cli {
164160 $Path = [System.Environment ]::GetEnvironmentVariable(' Path' , $User )
165161 if (! (" ;${Path} ;" .ToLower() -like " *;${slack_cli_bin_dir} ;*" .ToLower())) {
166162 Write-Host " Adding `` $confirmed_alias .exe`` to your Path environment variable"
167- [System.Environment ]::SetEnvironmentVariable(' Path' , $Path.TrimEnd (' ;' ) + " ;${slack_cli_bin_dir} " , $User )
163+ if ([Environment ]::UserInteractive) {
164+ try {
165+ [System.Environment ]::SetEnvironmentVariable(' Path' , $Path.TrimEnd (' ;' ) + " ;${slack_cli_bin_dir} " , $User )
166+ }
167+ catch {
168+ # Silently continue if SetEnvironmentVariable fails
169+ }
170+ }
168171 $Env: Path = $Env: Path.TrimEnd (' ;' ) + " ;$slack_cli_bin_dir "
169172 }
170173
171- $old = $ErrorActionPreference
172- $ErrorActionPreference = ' Continue'
173- try {
174- $fp = (& $confirmed_alias _fingerprint 2>&1 | Out-String ).Trim()
175- Write-Host " nooo $fp "
176- } finally {
177- $ErrorActionPreference = $old
178- }
179-
180174 Remove-Item " $ ( $slack_cli_dir ) \slack_cli.zip"
181175}
182176
0 commit comments