File tree Expand file tree Collapse file tree 4 files changed +6
-30
lines changed Expand file tree Collapse file tree 4 files changed +6
-30
lines changed Original file line number Diff line number Diff line change @@ -82,6 +82,8 @@ impl Session {
82
82
self . close_impl ( ) . await ?;
83
83
84
84
tempdir. close ( ) . map_err ( Error :: Cleanup ) ?;
85
+ } else {
86
+ self . close_impl ( ) . await ?;
85
87
}
86
88
87
89
Ok ( ( ) )
@@ -96,17 +98,6 @@ impl Session {
96
98
} ) ,
97
99
)
98
100
}
99
-
100
- /// Forced termination, ignores value of `tempdir`
101
- pub ( crate ) async fn force_terminate ( self ) -> Result < ( ) , Error > {
102
- if self . tempdir . is_some ( ) {
103
- self . close ( ) . await
104
- } else {
105
- self . close_impl ( ) . await ?;
106
-
107
- Ok ( ( ) )
108
- }
109
- }
110
101
}
111
102
112
103
impl Drop for Session {
Original file line number Diff line number Diff line change @@ -184,6 +184,8 @@ impl Session {
184
184
self . close_impl ( ) . await ?;
185
185
186
186
tempdir. close ( ) . map_err ( Error :: Cleanup ) ?;
187
+ } else {
188
+ self . close_impl ( ) . await ?;
187
189
}
188
190
189
191
Ok ( ( ) )
@@ -194,17 +196,6 @@ impl Session {
194
196
( self . ctl . clone ( ) , self . master_log . take ( ) )
195
197
}
196
198
197
- /// Forced termination, ignores value of `tempdir`
198
- pub ( crate ) async fn force_terminate ( self ) -> Result < ( ) , Error > {
199
- if self . tempdir . is_some ( ) {
200
- self . close ( ) . await
201
- } else {
202
- self . close_impl ( ) . await ?;
203
-
204
- Ok ( ( ) )
205
- }
206
- }
207
-
208
199
fn discover_master_error ( & self ) -> Option < Error > {
209
200
let err = match fs:: read_to_string ( self . master_log . as_ref ( ) ?) {
210
201
Ok ( err) => err,
Original file line number Diff line number Diff line change @@ -328,10 +328,4 @@ impl Session {
328
328
pub fn detach ( self ) -> ( Box < Path > , Option < Box < Path > > ) {
329
329
delegate ! ( self . 0 , imp, { imp. detach( ) } )
330
330
}
331
-
332
- /// Force terminate the remote connection, even if it is created
333
- /// by [`Session::resume`] or [`Session::resume_mux`].
334
- pub async fn force_terminate ( self ) -> Result < ( ) , Error > {
335
- delegate ! ( self . 0 , imp, { imp. force_terminate( ) . await } )
336
- }
337
331
}
Original file line number Diff line number Diff line change @@ -865,7 +865,7 @@ async fn test_detach_and_resume_process_mux() {
865
865
let session2 = Session :: resume ( ctl1, master_log1) ;
866
866
session2. check ( ) . await . unwrap ( ) ;
867
867
868
- session2. force_terminate ( ) . await . unwrap ( ) ;
868
+ session2. close ( ) . await . unwrap ( ) ;
869
869
870
870
// Wait for ssh multiplex master to clean up and exit.
871
871
sleep ( Duration :: from_secs ( 3 ) ) . await ;
@@ -910,7 +910,7 @@ async fn test_detach_and_resume_native_mux() {
910
910
let session2 = Session :: resume_mux ( ctl1, master_log1) ;
911
911
session2. check ( ) . await . unwrap ( ) ;
912
912
913
- session2. force_terminate ( ) . await . unwrap ( ) ;
913
+ session2. close ( ) . await . unwrap ( ) ;
914
914
915
915
// Wait for ssh multiplex master to clean up and exit.
916
916
sleep ( Duration :: from_secs ( 3 ) ) . await ;
You can’t perform that action at this time.
0 commit comments