@@ -66,33 +66,26 @@ impl BeamCompiler {
66
66
let mut buf = String :: new ( ) ;
67
67
let mut accumulated_modules: Vec < String > = Vec :: new ( ) ;
68
68
while let ( Ok ( _) , Ok ( None ) ) = ( inner. stdout . read_line ( & mut buf) , inner. process . try_wait ( ) ) {
69
- let trimmed = buf. trim ( ) ;
70
-
71
- if trimmed. starts_with ( "gleam-compile" ) {
72
- match trimmed {
73
- "gleam-compile-result-ok" => {
74
- // Return Ok with the accumulated modules
75
- return Ok ( accumulated_modules) ;
76
- }
77
- "gleam-compile-result-error" => {
78
- return Err ( Error :: ShellCommand {
79
- program : "escript" . into ( ) ,
80
- err : None ,
81
- } ) ;
82
- }
83
- _ => { }
69
+ match buf. trim ( ) {
70
+ "gleam-compile-result-ok" => {
71
+ // Return Ok with the accumulated modules
72
+ return Ok ( accumulated_modules) ;
84
73
}
85
- } else if trimmed. starts_with ( "module:" ) {
86
- if let Some ( module_content) = trimmed. strip_prefix ( "module:" ) {
87
- accumulated_modules. push ( module_content. to_string ( ) ) ;
74
+ "gleam-compile-result-error" => {
75
+ return Err ( Error :: ShellCommand {
76
+ program : "escript" . into ( ) ,
77
+ err : None ,
78
+ } )
88
79
}
89
- } else {
90
- match stdio {
91
- Stdio :: Inherit => {
92
- print ! ( "{}" , buf) ;
80
+ s if s. starts_with ( "gleam-compile-module:" ) => {
81
+ if let Some ( module_content) = s. strip_prefix ( "gleam-compile-module:" ) {
82
+ accumulated_modules. push ( module_content. to_string ( ) ) ;
93
83
}
94
- Stdio :: Null => { }
95
84
}
85
+ _ => match stdio {
86
+ Stdio :: Inherit => print ! ( "{}" , buf) ,
87
+ Stdio :: Null => { }
88
+ } ,
96
89
}
97
90
98
91
buf. clear ( )
0 commit comments