openssh-rust / openssh

Scriptable SSH through OpenSSH in Rust
Apache License 2.0
232 stars 35 forks source link

Is it possible to clean up the historical control_directory before creating a SessionBuilder? #125

Closed baoyachi closed 1 year ago

baoyachi commented 1 year ago

Currently testing locally, the historical control_directory directory will always exist during each debugging session.

E.g:

➜ ll -als
total 0
0 drwxr-xr-x  6 root  staff   192B  7 28 10:03 .
0 drwxr-xr-x  3 root  staff    96B  7 27 18:25 ..
0 drwxr-xr-x  4 root  staff   128B  7 28 09:55 .ssh-connectionpCn9J7
0 drwxr-xr-x  2 root  staff    64B  7 28 10:01 .ssh-connectionpHq9a2
0 drwxr-xr-x  2 root  staff    64B  7 28 10:03 .ssh-connectionpJp983
0 drwxr-xr-x  2 root  staff    64B  7 28 10:05 .ssh-connectionpLwp24
NobodyXu commented 1 year ago

run_ci_tests.sh take care of that to remove these control-dirs.

baoyachi commented 1 year ago

Oh. Could we add a method in the code similar to clean_control_directory? With this method, I can control the file directory cached by control_directory before the code execution. If needed, I can submit a pull request .

NobodyXu commented 1 year ago

Oh. Could we add a method in the code similar to _clean_controldirectory?

Hmmm, I don't think such code belong to openssh, although removing unused cached directories also make sense.

I would accept a PR and would have to review it to see if it makes sense.