fix: make Windows portable Node bootstrap reliable
This commit is contained in:
@@ -68,6 +68,10 @@
|
||||
在普通 PowerShell 中逐行运行:
|
||||
|
||||
```powershell
|
||||
$dingUtf8 = New-Object System.Text.UTF8Encoding($false)
|
||||
[Console]::InputEncoding = $dingUtf8
|
||||
[Console]::OutputEncoding = $dingUtf8
|
||||
$OutputEncoding = $dingUtf8
|
||||
$dingBootstrapDir = Join-Path ([System.IO.Path]::GetTempPath()) ("dingmcp-bootstrap-" + [guid]::NewGuid().ToString("N"))
|
||||
New-Item -ItemType Directory -Path $dingBootstrapDir -Force | Out-Null
|
||||
$dingBootstrap = Join-Path $dingBootstrapDir "dingtalk-approval-bootstrap.ps1"
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
$ErrorActionPreference = "Stop"
|
||||
$ProgressPreference = "SilentlyContinue"
|
||||
$dingUtf8 = New-Object System.Text.UTF8Encoding($false)
|
||||
[Console]::InputEncoding = $dingUtf8
|
||||
[Console]::OutputEncoding = $dingUtf8
|
||||
$OutputEncoding = $dingUtf8
|
||||
if (Get-Variable -Name PSNativeCommandUseErrorActionPreference -ErrorAction SilentlyContinue) {
|
||||
$PSNativeCommandUseErrorActionPreference = $false
|
||||
}
|
||||
@@ -92,7 +96,7 @@ if (-not (Test-DingNode $dingNodePath $false)) {
|
||||
Join-Path $env:LOCALAPPDATA "DingTalkApproval"
|
||||
}
|
||||
$dingRuntimeParent = Join-Path $dingClientRoot "node"
|
||||
$dingRuntimeName = [IO.Path]::GetFileNameWithoutExtension([IO.Path]::GetFileNameWithoutExtension($dingNodeFile))
|
||||
$dingRuntimeName = [IO.Path]::GetFileNameWithoutExtension($dingNodeFile)
|
||||
$dingRuntimeDir = Join-Path $dingRuntimeParent $dingRuntimeName
|
||||
$dingNodePath = Join-Path $dingRuntimeDir "node.exe"
|
||||
if (-not (Test-DingNode $dingNodePath $true)) {
|
||||
|
||||
Reference in New Issue
Block a user