File tree Expand file tree Collapse file tree 2 files changed +15
-11
lines changed
Expand file tree Collapse file tree 2 files changed +15
-11
lines changed Original file line number Diff line number Diff line change @@ -14,10 +14,8 @@ use crate::event::Event;
1414pub fn send_events ( command : & str , events : & [ Event ] ) {
1515 match serde_json:: to_string_pretty ( & events) {
1616 Ok ( events_json) => {
17- let tempfile_path = match env:: var ( "VOLTA_WRITE_EVENTS_FILE" ) {
18- Ok ( _) => write_events_file ( events_json. clone ( ) ) ,
19- Err ( _) => None ,
20- } ;
17+ let tempfile_path = env:: var_os ( "VOLTA_WRITE_EVENTS_FILE" )
18+ . and_then ( |_| write_events_file ( events_json. clone ( ) ) ) ;
2119 if let Some ( ref mut child_process) = spawn_process ( command, tempfile_path) {
2220 if let Some ( ref mut p_stdin) = child_process. stdin . as_mut ( ) {
2321 if let Err ( error) = writeln ! ( p_stdin, "{}" , events_json) {
Original file line number Diff line number Diff line change @@ -147,27 +147,33 @@ impl Session {
147147 }
148148
149149 fn publish_to_event_log ( self ) {
150- let plugin_res = self
151- . hooks ( )
150+ let Self {
151+ project,
152+ hooks,
153+ mut event_log,
154+ ..
155+ } = self ;
156+ let plugin_res = project
157+ . get ( )
158+ . and_then ( |p| hooks. get ( p) )
152159 . map ( |hooks| hooks. events ( ) . and_then ( |e| e. publish . as_ref ( ) ) ) ;
153160 match plugin_res {
154161 Ok ( plugin) => {
155- self . event_log . publish ( plugin) ;
162+ event_log. add_event_args ( ) ;
163+ event_log. publish ( plugin) ;
156164 }
157165 Err ( e) => {
158166 debug ! ( "Unable to publish event log.\n {}" , e) ;
159167 }
160168 }
161169 }
162170
163- pub fn exit ( mut self , code : ExitCode ) -> ! {
164- self . event_log . add_event_args ( ) ;
171+ pub fn exit ( self , code : ExitCode ) -> ! {
165172 self . publish_to_event_log ( ) ;
166173 code. exit ( ) ;
167174 }
168175
169- pub fn exit_tool ( mut self , code : i32 ) -> ! {
170- self . event_log . add_event_args ( ) ;
176+ pub fn exit_tool ( self , code : i32 ) -> ! {
171177 self . publish_to_event_log ( ) ;
172178 exit ( code) ;
173179 }
You can’t perform that action at this time.
0 commit comments