@insert(sh-prelude)@

"@expand(@MOAR@)@" @expand(@runner_opts@)@ -e @q(
say "=" x 96;

say qq:to/END/;
This is Rakudo running in valgrind, a tool for debugging and profiling programs.
Running a program in valgrind usually takes *a lot* more time than running it directly,
so please be patient.
Valgrind options can be added with MVM_VALGRIND_OPTS environment variable.
END
say "This Rakudo version is $*RAKU.compiler.version() built on MoarVM version $*VM.version(),";
say "running on $*DISTRO.gist() / $*KERNEL.gist()";

say "-" x 96;
)@

VALGRIND="valgrind"
if [ -n "$RAKUDO_VALGRIND" ]; then
    VALGRIND="$RAKUDO_VALGRIND"
fi
"$VALGRIND" ${MVM_VALGRIND_OPTS} "@expand(@MOAR@)@" @expand(@runner_opts@)@ "$@"
