Skip to content

Instantly share code, notes, and snippets.

@ugexe
Created November 22, 2014 07:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ugexe/bdc0ce756bb7d0d005c2 to your computer and use it in GitHub Desktop.
Save ugexe/bdc0ce756bb7d0d005c2 to your computer and use it in GitHub Desktop.
# current behavior: no exit code
multi MAIN ('install', *@modules, Bool :$notests, Bool :$nodeps) {
for @modules -> $x {
try {
$panda.resolve($x, :$notests, :$nodeps, :action<install>);
CATCH { when X::Panda { say $_.message } }
};
}
}
# exits non-zero on failure without finishing iterating @modules
multi MAIN ('install', *@modules, Bool :$notests, Bool :$nodeps) {
my $failures;
for @modules -> $x {
try {
$panda.resolve($x, :$notests, :$nodeps, :action<install>);
CATCH { when X::Panda { $failures++ && say $_.message } }
};
}
exit $failures;
}
# exits non-zero on failure after finishing iterating @modules
multi MAIN ('install', *@modules, Bool :$notests, Bool :$nodeps) {
my @failed;
for @modules -> $x {
try {
$panda.resolve($x, :$notests, :$nodeps, :action<install>);
CATCH { when X::Panda { @failed.push($_) && say $_.message } }
};
}
exit @failed.elems; # or summary report on array of exceptions?
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment