From c1b91fa95dc826be3e1df515b854074b540d8030 Mon Sep 17 00:00:00 2001 From: xyrar Date: Sat, 4 Oct 2025 21:05:51 +0100 Subject: [PATCH] Update x.ps1 --- x.ps1 | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/x.ps1 b/x.ps1 index afd988e67e4cd..485c4f4de3d60 100755 --- a/x.ps1 +++ b/x.ps1 @@ -5,18 +5,18 @@ $ErrorActionPreference = "Stop" # syntax check -Get-Command -syntax ${PSCommandPath} >$null +Get-Command -Syntax $PSCommandPath > $null $xpy = Join-Path $PSScriptRoot x.py $xpy_args = @($xpy) + $args -function Get-Application($app) { +function Get-Application { param($app) $cmd = Get-Command $app -ErrorAction SilentlyContinue -CommandType Application | Select-Object -First 1 return $cmd } -function Invoke-Application($application, $arguments) { - & $application $arguments +function Invoke-Application { param($application, $arguments) + & $application @arguments Exit $LASTEXITCODE } @@ -33,13 +33,13 @@ foreach ($python in "py", "python3", "python", "python2") { } } -$found = (Get-Application "python*" | Where-Object {$_.name -match '^python[2-3]\.[0-9]+(\.exe)?$'}) +$found = Get-Application "python*" | Where-Object { $_.Name -match '^python[2-3]\.[0-9]+(\.exe)?$' } if (($null -ne $found) -and ($found.Length -ge 1)) { $python = $found[0] Invoke-Application $python $xpy_args } -$msg = "${PSCommandPath}: error: did not find python installed`n" +$msg = "$PSCommandPath: error: did not find python installed`n" $msg += "help: consider installing it from https://www.python.org/downloads/" Write-Error $msg -Category NotInstalled Exit 1