Skip to content

Commit 7d1232c

Browse files
committed
Impl process_impl::Session::subsystem
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
1 parent f40dd09 commit 7d1232c

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/process_impl/session.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,18 @@ impl Session {
8181
Command::new(cmd)
8282
}
8383

84+
pub(crate) fn subsystem<S: AsRef<OsStr>>(&self, program: S) -> Command {
85+
// XXX: Should we do a self.check() here first?
86+
87+
// NOTE: we pass -p 9 nine here (the "discard" port) to ensure that ssh does not
88+
// succeed in establishing a _new_ connection if the master connection has failed.
89+
90+
let mut cmd = self.new_cmd(&["-T", "-p", "9", "-s"]);
91+
cmd.arg("--").arg(program);
92+
93+
Command::new(cmd)
94+
}
95+
8496
pub(crate) async fn request_port_forward(
8597
&self,
8698
forward_type: impl Into<ForwardType>,

0 commit comments

Comments
 (0)