Skip to content

Commit

Permalink
Merge pull request #2188 from xelak6/master
Browse files Browse the repository at this point in the history
Prevent REPL from writing to filehandle when opening a file.
  • Loading branch information
zoffixznet committed Aug 7, 2018
2 parents f8b7930 + 07d00db commit 7c08ba7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/core/REPL.pm6
Expand Up @@ -396,7 +396,7 @@ do {

method repl-print(Mu $value --> Nil) {
nqp::can($value, 'gist')
and $value.say
and say $value
or say "(low-level object `$value.^name()`)";

CATCH {
Expand Down
8 changes: 7 additions & 1 deletion t/02-rakudo/repl.t
Expand Up @@ -3,7 +3,7 @@ use lib <t/packages>;
use Test;
use Test::Helpers;

plan 44;
plan 45;

my $*REPL-SCRUBBER = -> $_ is copy {
s/^^ "You may want to `zef install Readline` or `zef install Linenoise`"
Expand Down Expand Up @@ -307,3 +307,9 @@ is-run-repl 'say "b".subst(/(.)/,{$0~$0}); say "%20" ~~ /:i \%(<[0..9A..F]>**2)/
# https://github.com/rakudo/rakudo/issues/1925
is-run-repl '&say.package', :out{.contains: 'GLOBAL'}, :err(''),
REPL can auto-print non-Mu things that lack .WHERE and .gist;

#https://github.com/rakudo/rakudo/issues/2184
is-run-repl 'my $fh = $*EXECUTABLE.open(:r)',
:out{.contains: 'IO::Handle' and not .contains('Failed to write')},
:err(''),
no complaints about failed writing to filehandle when opening a file;

0 comments on commit 7c08ba7

Please sign in to comment.