Skip to content

Commit

Permalink
Rollup merge of rust-lang#111151 - ozkanonur:syntax-check-on-bootstra…
Browse files Browse the repository at this point in the history
…p-scripts, r=Mark-Simulacrum

check bootstrap scripts syntax

Fails bootstrapping if `x`/`x.ps1` scripts are not valid. Currently, it keeps executing lines until the invalid one.
  • Loading branch information
matthiaskrgr authored May 6, 2023
2 parents 89f0efd + eea6202 commit 413cff2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
5 changes: 4 additions & 1 deletion x
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,12 @@

set -eu

# syntax check
sh -n $0

realpath() {
if [ -d "$1" ]; then
CDPATH='' command cd "$1" && pwd -P
CDPATH='' command cd "$1" && pwd -P
else
echo "$(realpath "$(dirname "$1")")/$(basename "$1")"
fi
Expand Down
5 changes: 5 additions & 0 deletions x.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

# See ./x for why these scripts exist.

$ErrorActionPreference = "Stop"

# syntax check
Get-Command -syntax ${PSCommandPath}

$xpy = Join-Path $PSScriptRoot x.py
# Start-Process for some reason splits arguments on spaces. (Isn't powershell supposed to be simpler than bash?)
# Double-quote all the arguments so it doesn't do that.
Expand Down

0 comments on commit 413cff2

Please sign in to comment.