mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 10:10:45 +00:00
fix(release): stabilize windows npm install
This commit is contained in:
@@ -220,7 +220,8 @@ function Invoke-NativeCommandCapture {
|
||||
param(
|
||||
[Parameter(Mandatory = $true)]
|
||||
[string]$FilePath,
|
||||
[string[]]$Arguments = @()
|
||||
[string[]]$Arguments = @(),
|
||||
[string]$WorkingDirectory = ""
|
||||
)
|
||||
|
||||
$stdoutPath = [System.IO.Path]::GetTempFileName()
|
||||
@@ -253,12 +254,19 @@ function Invoke-NativeCommandCapture {
|
||||
)
|
||||
}
|
||||
|
||||
$process = Start-Process -FilePath $startFilePath `
|
||||
-ArgumentList $startArguments `
|
||||
-Wait `
|
||||
-PassThru `
|
||||
-RedirectStandardOutput $stdoutPath `
|
||||
-RedirectStandardError $stderrPath
|
||||
$startProcessArgs = @{
|
||||
FilePath = $startFilePath
|
||||
ArgumentList = $startArguments
|
||||
Wait = $true
|
||||
PassThru = $true
|
||||
RedirectStandardOutput = $stdoutPath
|
||||
RedirectStandardError = $stderrPath
|
||||
}
|
||||
if (![string]::IsNullOrWhiteSpace($WorkingDirectory)) {
|
||||
$startProcessArgs.WorkingDirectory = $WorkingDirectory
|
||||
}
|
||||
|
||||
$process = Start-Process @startProcessArgs
|
||||
|
||||
return @{
|
||||
ExitCode = $process.ExitCode
|
||||
@@ -270,6 +278,12 @@ function Invoke-NativeCommandCapture {
|
||||
}
|
||||
}
|
||||
|
||||
function Get-NpmWorkingDirectory {
|
||||
$workingDirectory = Join-Path ([System.IO.Path]::GetTempPath()) "openclaw-installer"
|
||||
New-Item -ItemType Directory -Path $workingDirectory -Force | Out-Null
|
||||
return $workingDirectory
|
||||
}
|
||||
|
||||
function Install-OpenClawNpm {
|
||||
param([string]$Target = "latest")
|
||||
|
||||
@@ -286,7 +300,7 @@ function Install-OpenClawNpm {
|
||||
$installSpec,
|
||||
"--no-fund",
|
||||
"--no-audit"
|
||||
)
|
||||
) -WorkingDirectory (Get-NpmWorkingDirectory)
|
||||
if ($installResult.Stdout) {
|
||||
Microsoft.PowerShell.Utility\Write-Host $installResult.Stdout
|
||||
}
|
||||
@@ -468,7 +482,7 @@ function Main {
|
||||
"config",
|
||||
"get",
|
||||
"prefix"
|
||||
)
|
||||
) -WorkingDirectory (Get-NpmWorkingDirectory)
|
||||
$npmPrefix = $prefixResult.Stdout
|
||||
if ($prefixResult.ExitCode -eq 0 -and $npmPrefix) {
|
||||
Add-ToPath -Path "$npmPrefix"
|
||||
|
||||
Reference in New Issue
Block a user