flush
ErrorsCollection

flush

Synthesised documentation from type/IO/Handle type/IO/CatHandle

From type/IO/Handle

See Original text in context

method flush(IO::Handle:D: --> True)

Will flush the handle, writing any of the buffered data. Returns True on success; otherwise, Fails with X::IO::Flush.

given "foo".IO.open: :w {
    LEAVE .close;
    .print: 'something';
    'foo'.IO.slurp.say# (if the data got buffered) OUTPUT: «␤» 
    .flush;             # flush the handle 
    'foo'.IO.slurp.say# OUTPUT: «something␤» 
}

From type/IO/CatHandle

See Original text in context

multi method flush(|)

The IO::CatHandle type overrides this method to throw a X::NYI exception. If you have a good idea for how this method should behave, tell Rakudo developers about it!