Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

better message for nonexistent files on the commandline.

  • Loading branch information...
commit 6b97517ab5f34eb64f682c5639abf8a3132ab220 1 parent 7399985
@timo timo authored
Showing with 14 additions and 2 deletions.
  1. +14 −2 src/HLL/Compiler.pm
View
16 src/HLL/Compiler.pm
@@ -445,10 +445,22 @@ class HLL::Compiler does HLL::Backend::Default {
my @files := nqp::islist($files) ?? $files !! [$files];
$!user_progname := nqp::join(',', @files);
my @codes;
- for @files {
+ for @files -> $filename {
+ if !nqp::stat($filename, 0) {
+ nqp::say("Could not stat $filename: No such file or directory.");
+ nqp::exit(1);
+ }
my $err := 0;
+ my $in-handle;
+ try {
+ $in-handle := nqp::open($filename, 'r');
+ CATCH {
+ nqp::say("Could not open $filename. $_");
+ $err := 1;
+ }
+ }
+ nqp::exit(1) if $err;
try {
- my $in-handle := nqp::open($_, 'r');
nqp::setencoding($in-handle, $encoding);
nqp::push_s(@codes, nqp::readallfh($in-handle));
nqp::closefh($in-handle);
Please sign in to comment.
Something went wrong with that request. Please try again.