]> git.lizzy.rs Git - rust.git/blob - x.ps1
do not implement type traversal for `EarlyBinder`
[rust.git] / x.ps1
1 #!/usr/bin/env pwsh
2
3 # See ./x for why these scripts exist.
4
5 $xpy = Join-Path $PSScriptRoot x.py
6 # Start-Process for some reason splits arguments on spaces. (Isn't powershell supposed to be simpler than bash?)
7 # Double-quote all the arguments so it doesn't do that.
8 $xpy_args = @("""$xpy""")
9 foreach ($arg in $args) {
10     $xpy_args += """$arg"""
11 }
12
13 foreach ($python in "py", "python3", "python", "python2") {
14     # NOTE: this only tests that the command exists in PATH, not that it's actually
15     # executable. The latter is not possible in a portable way, see
16     # https://github.com/PowerShell/PowerShell/issues/12625.
17     if (Get-Command $python -ErrorAction SilentlyContinue) {
18         if ($python -eq "py") {
19             # Use python3, not python2
20             $xpy_args = @("-3") + $xpy_args
21         }
22         $process = Start-Process -NoNewWindow -Wait -PassThru $python $xpy_args
23         Exit $process.ExitCode
24     }
25 }
26
27 Write-Error "${PSCommandPath}: error: did not find python installed"
28 Exit 1