Subject: | Shell-Source 0.01 script error not returned |
Date: | Wed, 6 Oct 2010 13:55:03 -0400 |
To: | bug-Shell-Source [...] rt.cpan.org |
From: | Chris Gefvert <chris.gefvert [...] gmail.com> |
I'm running perl, v5.8.2 built for aix-thread-multi on AIX 5307. Not
that that matters since your module is pureperl.
I noticed that that sourcing a script like this sample that errors
during execution did not cause Shell::Source to return an error.
#!/usr/bin/ksh
echo running $0
sleep 1
echo running $0
return 1
So I added evaluation of $? for ksh and bash like so.
my $shells =
{
csh => "csh -f -c 'source [[file]]; env' |",
tcsh => "tcsh -f -c 'source [[file]]; env' |",
sh => "sh -c '. [[file]]; env' |",
ksh => "ksh -c '. [[file]]; [[ \$? > 0 ]] && return \$? ; env' |",
zsh => "zsh -c '. [[file]]; env' |",
bash => "bash -norc -noprofile -c '. [[file]]; [[ \$? > 0 ]] &&
return \$? ; env' |",
};