File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -240,28 +240,26 @@ impl Nail for RawFdNail {
240240
241241 // Spawn the underlying function as a blocking task, and capture its exit code to append to the
242242 // output stream.
243- let executor = self . executor . clone ( ) ;
244243 let nail = self . clone ( ) ;
245- let exit_code_join = executor . native_spawn_blocking ( move || {
246- // NB: This closure captures the stdio handles, and will drop/close them when it completes.
247- ( nail . runner ) ( RawFdExecution {
248- cmd ,
249- cancelled ,
250- stdin_fd : stdin_handle . as_raw_fd ( ) ,
251- stdout_fd : stdout_handle . as_raw_fd ( ) ,
252- stderr_fd : stderr_handle . as_raw_fd ( ) ,
253- } )
254- } ) ;
255- let exit_code = async move {
256- match exit_code_join . await {
257- Ok ( code ) => code ,
258- Err ( e ) => {
244+ let exit_code = self
245+ . executor
246+ . spawn_blocking (
247+ move || {
248+ // NB: This closure captures the stdio handles, and will drop/close them when it completes.
249+ ( nail . runner ) ( RawFdExecution {
250+ cmd ,
251+ cancelled ,
252+ stdin_fd : stdin_handle . as_raw_fd ( ) ,
253+ stdout_fd : stdout_handle . as_raw_fd ( ) ,
254+ stderr_fd : stderr_handle . as_raw_fd ( ) ,
255+ } )
256+ } ,
257+ |e| {
259258 log:: warn!( "Server exited uncleanly: {e}" ) ;
260259 ExitCode ( 1 )
261- }
262- }
263- }
264- . boxed ( ) ;
260+ } ,
261+ )
262+ . boxed ( ) ;
265263
266264 // Select a single stdout/stderr stream.
267265 let stdout_stream = stdout_stream. map_ok ( ChildOutput :: Stdout ) ;
Original file line number Diff line number Diff line change @@ -187,9 +187,9 @@ impl Executor {
187187 pub fn spawn_blocking < F : FnOnce ( ) -> R + Send + ' static , R : Send + ' static > (
188188 & self ,
189189 f : F ,
190- rescue_join_error : impl FnOnce ( JoinError ) -> R ,
191- ) -> impl Future < Output = R > {
192- self . native_spawn_blocking ( f) . map ( |res| match res {
190+ rescue_join_error : impl FnOnce ( JoinError ) -> R + Send + ' static ,
191+ ) -> impl Future < Output = R > + Send + ' static {
192+ self . native_spawn_blocking ( f) . map ( move |res| match res {
193193 Ok ( o) => o,
194194 Err ( e) => rescue_join_error ( e) ,
195195 } )
Original file line number Diff line number Diff line change @@ -99,14 +99,13 @@ impl ProdashInstance {
9999 // Drop all tasks to clear the Tree. The call to shutdown will render a final "Tick" with the
100100 // empty Tree, which will clear the screen.
101101 self . tasks_to_display . clear ( ) ;
102- let executor = self . executor . clone ( ) ;
103- let shutdown = executor. native_spawn_blocking ( move || self . handle . shutdown_and_wait ( ) ) ;
104- async move {
105- if let Err ( e) = shutdown. await {
106- fatal_log ! ( "Failed to teardown UI: {e}" ) ;
107- }
108- }
109- . boxed ( )
102+ self . executor
103+ . clone ( )
104+ . spawn_blocking (
105+ move || self . handle . shutdown_and_wait ( ) ,
106+ |e| fatal_log ! ( "Failed to teardown UI: {e}" ) ,
107+ )
108+ . boxed ( )
110109 }
111110
112111 pub fn render ( & mut self , heavy_hitters : & HashMap < SpanId , ( String , SystemTime ) > ) {
You can’t perform that action at this time.
0 commit comments