This works now and it looks like it has been fixed for quite a while.
IMHO this was the same problem as that from RT #113078 ("[BUG] $*PROGRAM_NAME
erroneously reports the first argument to 'perl6', even when this argument
isn't a program name in Rakudo"). Since there is a test in
S02-magicals/progname.t I didn't add a second test for this specific occurence
of the problem.
(My test would have been:)
# RT #112584
{
use lib 't/spec/packages';
use Test::Util;
is_run 'use v6; sub MAIN (Str $bar) { }',
{
out => '',
err => /Usage\: \s+ getout/, ## temp script file starts with getout
},
:compiler-args['--stagestats'],
'USAGE message contains script name when using compiler arg
--stagestats';