22
33use std:: {
44 fs:: { self , File } ,
5- io:: BufRead ,
65 net:: TcpStream ,
76 process:: { Command , Stdio } ,
87 thread,
@@ -95,7 +94,13 @@ pub async fn start_shared_node() -> Result<u32> {
9594 }
9695
9796 // Start the node process
98- let mut child = Command :: new ( "miden-node" )
97+ // Use Stdio::null() for stdout/stderr to avoid buffer blocking issues.
98+ // When pipes are used, the child process can block if the pipe buffer fills up
99+ // and the reading end doesn't consume data fast enough. Using inherit() also
100+ // causes issues with nextest's parallel test execution.
101+ //
102+ // For debugging, users can run the node manually with RUST_LOG=debug.
103+ let child = Command :: new ( "miden-node" )
99104 . args ( [
100105 "bundled" ,
101106 "start" ,
@@ -106,37 +111,13 @@ pub async fn start_shared_node() -> Result<u32> {
106111 "--block.interval" ,
107112 "1sec" ,
108113 ] )
109- . stdout ( Stdio :: piped ( ) )
110- . stderr ( Stdio :: piped ( ) )
114+ . stdout ( Stdio :: null ( ) )
115+ . stderr ( Stdio :: null ( ) )
111116 . spawn ( )
112117 . context ( "Failed to start miden-node process" ) ?;
113118
114119 let pid = child. id ( ) ;
115120
116- // Capture output for debugging
117- let stdout = child. stdout . take ( ) . expect ( "Failed to capture stdout" ) ;
118- let stderr = child. stderr . take ( ) . expect ( "Failed to capture stderr" ) ;
119-
120- // Check if node output logging is enabled
121- let enable_node_output = std:: env:: var ( "MIDEN_NODE_OUTPUT" ) . unwrap_or_default ( ) == "1" ;
122-
123- // Spawn threads to read output
124- thread:: spawn ( move || {
125- let reader = std:: io:: BufReader :: new ( stdout) ;
126- for line in reader. lines ( ) . map_while ( Result :: ok) {
127- if enable_node_output {
128- eprintln ! ( "[shared node stdout] {line}" ) ;
129- }
130- }
131- } ) ;
132-
133- thread:: spawn ( move || {
134- let reader = std:: io:: BufReader :: new ( stderr) ;
135- for line in reader. lines ( ) . map_while ( Result :: ok) {
136- eprintln ! ( "[shared node stderr] {line}" ) ;
137- }
138- } ) ;
139-
140121 // Detach the child process so it continues running after we exit
141122 drop ( child) ;
142123
0 commit comments