Skip to content

Commit 22b186b

Browse files
committed
Emit an error message when rmc-rustc fails (rust-lang#328)
* Emit an error message when rmc-rustc fails * indicate what was missing in rmc-rustc error message
1 parent a977a2e commit 22b186b

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

scripts/rmc-rustc

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,19 @@
22
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
33
# SPDX-License-Identifier: Apache-2.0 OR MIT
44

5-
set -o errexit
6-
set -o pipefail
7-
set -o nounset
5+
set -eu
6+
87
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
9-
RUST_DIR=$SCRIPT_DIR/..
10-
RMC_RUSTC=`find $RUST_DIR/build -name "rustc" -print | grep stage1`
11-
$RMC_RUSTC "$@"
8+
REPO_DIR="$(dirname $SCRIPT_DIR)"
9+
10+
shopt -s nullglob
11+
RMC_CANDIDATES=("$REPO_DIR"/build/*/stage1/bin/rustc)
12+
13+
if [[ ${#RMC_CANDIDATES[@]} -ne 1 ]]; then
14+
echo "ERROR: Could not find RMC binary."
15+
echo "Looked for: $REPO_DIR/build/*/stage1/bin/rustc"
16+
echo "Was RMC successfully built first?"
17+
exit 1
18+
fi
19+
20+
"${RMC_CANDIDATES[0]}" "$@"

0 commit comments

Comments
 (0)