-
Notifications
You must be signed in to change notification settings - Fork 44
Open
Description
I just installed cfcli (windows 11, arm64, node 24) and it doesn't seem to work out of the box. The script stub is found, but the node implementation looks for supporting files relative to the stub, not the nodejs implementation, i.e.
So I added a try/finally with a pushd/popd pairing to set the write working directory:
#!/usr/bin/env pwsh
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
$exe=""
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
# Fix case when both the Windows and Linux builds of Node
# are installed in the same directory
$exe=".exe"
}
$ret=0
try {
# set cwd
pushd (join-path $basedir "node_modules/cloudflare-cli/")
if (Test-Path "$basedir/node$exe") {
# Support pipeline input
if ($MyInvocation.ExpectingInput) {
$input | & "$basedir/node$exe" "$basedir/node_modules/cloudflare-cli/bin/cfcli" $args
} else {
& "$basedir/node$exe" "$basedir/node_modules/cloudflare-cli/bin/cfcli" $args
}
$ret=$LASTEXITCODE
} else {
# Support pipeline input
if ($MyInvocation.ExpectingInput) {
$input | & "node$exe" "$basedir/node_modules/cloudflare-cli/bin/cfcli" $args
} else {
& "node$exe" "$basedir/node_modules/cloudflare-cli/bin/cfcli" $args
}
$ret=$LASTEXITCODE
}
} finally { popd }
exit $retMetadata
Metadata
Assignees
Labels
No labels