File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ use converter::Converter;
12
12
use reader:: * ;
13
13
use std:: error:: Error ;
14
14
use std:: io;
15
+ use std:: io:: Write ;
15
16
use std:: process;
16
17
17
18
struct Args < ' a > {
@@ -31,6 +32,8 @@ fn run(args: Args) -> Result<bool, String> {
31
32
32
33
let c = Converter :: new ( tz, fmt) ?;
33
34
let stdin = io:: stdin ( ) ;
35
+ let stdout = io:: stdout ( ) ;
36
+ let mut writer = stdout. lock ( ) ;
34
37
35
38
let reader = match filename {
36
39
Some ( "-" ) => InputReader :: new ( Input :: Stdin ( & stdin) ) ,
@@ -46,12 +49,12 @@ fn run(args: Args) -> Result<bool, String> {
46
49
let mut has_next = true ;
47
50
let mut buf = String :: new ( ) ;
48
51
49
- print ! ( "{}" , c. convert( reader. first_line( ) ) ) ;
52
+ write ! ( writer , "{}" , c. convert( reader. first_line( ) ) ) ;
50
53
51
54
while follow || has_next {
52
55
match reader. read_line ( & mut buf) {
53
56
Ok ( bytes) if bytes > 0 => {
54
- print ! ( "{}" , c. convert( & buf) ) ;
57
+ write ! ( writer , "{}" , c. convert( & buf) ) ;
55
58
buf. clear ( ) ;
56
59
has_next = true ;
57
60
}
You can’t perform that action at this time.
0 commit comments