@@ -23,15 +23,24 @@ const VAR_ADDRESS: &str = "{ADDR}";
2323const VAR_LINE : & str = "{LINE}" ;
2424const VAR_FILE : & str = "{FILE}" ;
2525
26- fn report_process_errors ( child : Child ) -> Result < ( ) > {
27- let output = child. wait_with_output ( ) ?;
26+ fn report_process_errors ( mut child : Child ) -> Result < ( ) > {
27+ match child. try_wait ( ) ? {
28+ Some ( status) => {
29+ let output = child. wait_with_output ( ) ?;
2830
29- if !output. stdout . is_empty ( ) {
30- tracing:: debug!( "Proccess Out: {}" , String :: from_utf8( output. stdout) ?) ;
31- }
31+ if !output. stdout . is_empty ( ) {
32+ tracing:: debug!( "Proccess Out: {}" , String :: from_utf8( output. stdout) ?) ;
33+ }
3234
33- if !output. stderr . is_empty ( ) {
34- tracing:: error!( "Proccess Err: {}" , String :: from_utf8( output. stderr) ?) ;
35+ if !output. stderr . is_empty ( ) {
36+ tracing:: error!( "Proccess Err: {}" , String :: from_utf8( output. stderr) ?) ;
37+ }
38+
39+ tracing:: debug!( "Process exited with: {status}" ) ;
40+ }
41+ None => {
42+ tracing:: debug!( "Process still running, detaching..." ) ;
43+ }
3544 }
3645
3746 Ok ( ( ) )
@@ -330,6 +339,11 @@ pub fn run(
330339 app. args . insert ( 0 , "--" . to_string ( ) ) ;
331340 }
332341
342+ if let Some ( appname) = & plugin_config. appname {
343+ app. env_vars
344+ . insert ( "NVIM_APPNAME" . to_string ( ) , appname. clone ( ) ) ;
345+ }
346+
333347 match plugin_config. socket_type {
334348 Some ( SocketType :: Fsock ) => run_fsock ( & launcher, app, & nvim, & root_dir, file_str, line) ?,
335349 Some ( SocketType :: Netsock ) => run_netsock ( & launcher, app, & nvim, & root_dir, file_str, line) ?,
0 commit comments