Skip to content

Commit 294a1fe

Browse files
committed
flush filehandles and do not close stdout
AST printing was broken on my machine, also pmurias++ found the bug where we close stdout when this is either not wanted or sane.
1 parent 3c49975 commit 294a1fe

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/HLL/Compiler.nqp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,8 @@ class HLL::Compiler does HLL::Backend::Default {
259259
!! nqp::open($output, 'w');
260260
self.panic("Cannot write to $output") unless $fh;
261261
nqp::printfh($fh, $result);
262-
nqp::closefh($fh);
262+
nqp::flushfh($fh);
263+
nqp::closefh($fh) unless ($output eq '' || $output eq '-');
263264
}
264265
CATCH {
265266
$has_error := 1;
@@ -448,7 +449,9 @@ class HLL::Compiler does HLL::Backend::Default {
448449

449450
method dumper($obj, $name, *%options) {
450451
if nqp::can($obj, 'dump') {
451-
nqp::print($obj.dump());
452+
my $out := nqp::getstdout();
453+
nqp::printfh($out, $obj.dump());
454+
nqp::flushfh($out);
452455
}
453456
else {
454457
nqp::die("Cannot dump this object; no dump method");

0 commit comments

Comments
 (0)