-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathrun.ps1
More file actions
30 lines (27 loc) · 771 Bytes
/
Copy pathrun.ps1
File metadata and controls
30 lines (27 loc) · 771 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/usr/bin/env pwsh
param(
[string]$Python = "python",
[int]$TimeoutSeconds = 10,
[switch]$ShowNames
)
$ErrorActionPreference = "Stop"
if (-not (Test-Path -LiteralPath (Join-Path $PSScriptRoot "generated\__init__.py"))) {
throw "Generated bindings were not found. Run generate.ps1 first."
}
if (-not [System.IO.Path]::IsPathRooted($Python)) {
$callerPython = Join-Path (Get-Location).Path $Python
if (Test-Path -LiteralPath $callerPython -PathType Leaf) {
$Python = [System.IO.Path]::GetFullPath($callerPython)
}
}
$arguments = @(
(Join-Path $PSScriptRoot "app.py"),
"--timeout", $TimeoutSeconds
)
if ($ShowNames) {
$arguments += "--show-names"
}
& $Python @arguments
if ($LASTEXITCODE -ne 0) {
exit $LASTEXITCODE
}