Skip to content

Commit 4d4eeca

Browse files
committed
fix miri script
1 parent 517e1d7 commit 4d4eeca

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

miri

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -48,33 +48,34 @@ Pass extra flags to all cargo invocations.
4848
EOF
4949
)
5050

51-
## Run the subcommands that the user requested to always run first
51+
## We need to know where we are.
52+
# macOS does not have a useful readlink/realpath so we have to use Python instead...
53+
MIRIDIR=$(python3 -c 'import os, sys; print(os.path.dirname(os.path.realpath(sys.argv[1])))' "$0")
54+
55+
## Run the auto-things.
5256
if [ -z "$AUTO_OPS" ]; then
5357
export AUTO_OPS=42
5458

5559
# Run this first, so that the toolchain doesn't change after
5660
# other code has run.
57-
if [ -f ".auto-everything" ] || [ -f ".auto-toolchain" ] ; then
61+
if [ -f "$MIRIDIR/.auto-everything" ] || [ -f "$MIRIDIR/.auto-toolchain" ] ; then
5862
"$MIRIDIR"/rustup-toolchain
5963
fi
6064

61-
if [ -f ".auto-everything" ] || [ -f ".auto-fmt" ] ; then
65+
if [ -f "$MIRIDIR/.auto-everything" ] || [ -f "$MIRIDIR/.auto-fmt" ] ; then
6266
$0 fmt
6367
fi
6468

65-
if [ -f ".auto-everything" ] || [ -f ".auto-clippy" ] ; then
69+
if [ -f "$MIRIDIR/.auto-everything" ] || [ -f "$MIRIDIR/.auto-clippy" ] ; then
6670
$0 clippy -- -D warnings
6771
fi
6872
fi
6973

70-
## Preparation
71-
# macOS does not have a useful readlink/realpath so we have to use Python instead...
72-
MIRIDIR=$(python3 -c 'import os, sys; print(os.path.dirname(os.path.realpath(sys.argv[1])))' "$0")
73-
TOOLCHAIN=$(cd "$MIRIDIR"; rustup show active-toolchain | head -n 1 | cut -d ' ' -f 1)
74-
75-
# Determine command.
74+
## Determine command and toolchain.
7675
COMMAND="$1"
7776
[ $# -gt 0 ] && shift
77+
# Doing this *after* auto-toolchain logic above, since that might change the toolchain.
78+
TOOLCHAIN=$(cd "$MIRIDIR"; rustup show active-toolchain | head -n 1 | cut -d ' ' -f 1)
7879

7980
## Handle some commands early, since they should *not* alter the environment.
8081
case "$COMMAND" in

0 commit comments

Comments
 (0)