#!/bin/bash

# This script wraps the model checker produced for a Spin model in order to run
# it in the user's working directory. This ensures that if the model finds an
# issue, then the trail file gets written into the working directory instead of
# somewhere in the depths of Bazel's runfiles.

set -euo pipefail

runfiles_root="$(pwd)"

if [ -n "${BUILD_WORKING_DIRECTORY-}" ]; then
  cd "$BUILD_WORKING_DIRECTORY"
fi

exec "$runfiles_root/PAN_BINARY" "$@"
