Documentation for method flush

Documentation for method flush, assembled from the following types:

class IO::Handle

From IO::Handle

(IO::Handle) method flush

Defined as:

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" :w {
    LEAVE .close;
    $fh.print: 'something';
    'foo'.IO.slurp.say# (if the data got buffered) OUTPUT: «␤» 
    $fh.flush;          # flush the handle 
    'foo'.IO.slurp.say# OUTPUT: «something␤» 

class IO::CatHandle

From IO::CatHandle

(IO::CatHandle) method flush

Defined as:

multi method flush(|)

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