File tree Expand file tree Collapse file tree 2 files changed +9
-1
lines changed
Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -42,7 +42,14 @@ pub struct TerminalWriterMaker {
4242
4343impl std:: io:: Write for RemoteWriter {
4444 fn write ( & mut self , buf : & [ u8 ] ) -> std:: io:: Result < usize > {
45- let body = serde_json:: json!( { "Log" : buf} ) ;
45+ let log = if let Ok ( json_log) = serde_json:: from_slice :: < serde_json:: Value > ( buf) {
46+ serde_json:: to_string ( & json_log) . unwrap ( )
47+ } else {
48+ let string = String :: from_utf8 ( buf. to_vec ( ) )
49+ . map_err ( |e| std:: io:: Error :: new ( std:: io:: ErrorKind :: InvalidData , e) ) ?;
50+ string
51+ } ;
52+ let body = serde_json:: json!( { "Log" : log} ) ;
4653 let body = serde_json:: to_vec ( & body) . unwrap ( ) ;
4754 Request :: to ( & self . target ) . body ( body) . send ( ) . unwrap ( ) ;
4855 Ok ( buf. len ( ) )
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ use crate::{get_blob, PackageId};
66/// VFS (Virtual File System) helper struct for a file.
77/// Opening or creating a `File` will give you a `Result<File, VfsError>`.
88/// You can call its impl functions to interact with it.
9+ #[ derive( serde:: Deserialize , serde:: Serialize ) ]
910pub struct File {
1011 pub path : String ,
1112 pub timeout : u64 ,
You can’t perform that action at this time.
0 commit comments