@@ -161,19 +161,19 @@ impl FileDescription for io::Stdout {
161161 _self_ref : & FileDescriptionRef ,
162162 _communicate_allowed : bool ,
163163 bytes : & [ u8 ] ,
164- _dest : & MPlaceTy < ' tcx > ,
165- _ecx : & mut MiriInterpCx < ' tcx > ,
164+ dest : & MPlaceTy < ' tcx > ,
165+ ecx : & mut MiriInterpCx < ' tcx > ,
166166 ) -> InterpResult < ' tcx , io:: Result < usize > > {
167167 // We allow writing to stderr even with isolation enabled.
168- let result = Write :: write ( & mut { self } , bytes) ;
168+ let result = Ok ( Write :: write ( & mut { self } , bytes) ) ;
169169 // Stdout is buffered, flush to make sure it appears on the
170170 // screen. This is the write() syscall of the interpreted
171171 // program, we want it to correspond to a write() syscall on
172172 // the host -- there is no good in adding extra buffering
173173 // here.
174174 io:: stdout ( ) . flush ( ) . unwrap ( ) ;
175-
176- Ok ( result )
175+ ecx . write_byte_helper ( result , dest ) ? ;
176+ Ok ( Ok ( 0 ) )
177177 }
178178
179179 fn is_tty ( & self , communicate_allowed : bool ) -> bool {
@@ -191,12 +191,14 @@ impl FileDescription for io::Stderr {
191191 _self_ref : & FileDescriptionRef ,
192192 _communicate_allowed : bool ,
193193 bytes : & [ u8 ] ,
194- _dest : & MPlaceTy < ' tcx > ,
195- _ecx : & mut MiriInterpCx < ' tcx > ,
194+ dest : & MPlaceTy < ' tcx > ,
195+ ecx : & mut MiriInterpCx < ' tcx > ,
196196 ) -> InterpResult < ' tcx , io:: Result < usize > > {
197197 // We allow writing to stderr even with isolation enabled.
198198 // No need to flush, stderr is not buffered.
199- Ok ( Write :: write ( & mut { self } , bytes) )
199+ let result = Ok ( Write :: write ( & mut { self } , bytes) ) ;
200+ ecx. write_byte_helper ( result, dest) ?;
201+ Ok ( Ok ( 0 ) )
200202 }
201203
202204 fn is_tty ( & self , communicate_allowed : bool ) -> bool {
@@ -218,11 +220,13 @@ impl FileDescription for NullOutput {
218220 _self_ref : & FileDescriptionRef ,
219221 _communicate_allowed : bool ,
220222 bytes : & [ u8 ] ,
221- _dest : & MPlaceTy < ' tcx > ,
222- _ecx : & mut MiriInterpCx < ' tcx > ,
223+ dest : & MPlaceTy < ' tcx > ,
224+ ecx : & mut MiriInterpCx < ' tcx > ,
223225 ) -> InterpResult < ' tcx , io:: Result < usize > > {
224226 // We just don't write anything, but report to the user that we did.
225- Ok ( Ok ( bytes. len ( ) ) )
227+ let result = Ok ( Ok ( bytes. len ( ) ) ) ;
228+ ecx. write_byte_helper ( result, dest) ?;
229+ Ok ( Ok ( 0 ) )
226230 }
227231}
228232
@@ -628,7 +632,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
628632 return Ok ( ( ) ) ;
629633 } ;
630634
631- let result = match offset {
635+ let _result = match offset {
632636 None => fd. write ( & fd, communicate, & bytes, dest, this) ,
633637 Some ( offset) => {
634638 let Ok ( offset) = u64:: try_from ( offset) else {
@@ -641,9 +645,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
641645 fd. pwrite ( communicate, & bytes, offset, dest, this)
642646 }
643647 } ;
644- self . write_byte_helper ( result, dest) ?;
645648 Ok ( ( ) )
646- //Ok(Scalar::from_target_isize(this.try_unwrap_io_result(result)?, this))
647649 }
648650
649651 /// This function write bytes to the user supplied buffer and write the total number of bytes
0 commit comments