File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11# CHANGELOG
22
3+ ## version:0.0.27
4+
5+ - Flush the content of iosink when writing output to a file.
6+
37## version:0.0.26
48
59- Replace amberctl with pkgctl.
Original file line number Diff line number Diff line change @@ -108,6 +108,12 @@ class PrintLogger implements Logger {
108108 out.writeln ('$message ' );
109109 }
110110 }
111+
112+ /// Flushes the IOSink to ensure all the data is written. This is specially
113+ /// useful when writing to a file.
114+ Future <void > flush () async {
115+ await out.flush ();
116+ }
111117}
112118
113119/// Transforms a [message] with [level] to a string that contains the DateTime,
Original file line number Diff line number Diff line change @@ -146,6 +146,9 @@ class SshClient {
146146 stdoutSubscription.asFuture <void >(),
147147 stderrSubscription.asFuture <void >(),
148148 ]);
149+
150+ await logger.flush ();
151+
149152 // The streams as futures have already completed, so waiting for the
150153 // potentially async stream cancellation to complete likely has no benefit.
151154 stdoutSubscription.cancel ();
Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ void main() {
1818 logger.info ('cdf' );
1919 logger.warning ('gh' );
2020 logger.error ('jk' );
21- await data .flush ();
21+ await logger .flush ();
2222 final String content = fs.file ('log.txt' ).readAsStringSync ();
2323 expect (content, contains ('ERROR jk' ));
2424 expect (content, contains ('INFO cdf' ));
@@ -48,7 +48,7 @@ void main() {
4848 logger.info ('cdf' );
4949 logger.warning ('gh' );
5050 logger.error ('jk' );
51- await data .flush ();
51+ await logger .flush ();
5252 final String content = fs.file ('log.txt' ).readAsStringSync ();
5353 expect (content, contains ('ERROR jk' ));
5454 expect (content, contains ('INFO cdf' ));
You can’t perform that action at this time.
0 commit comments