All three PuTTY clients require the port to be separated from the "-P" argument
Unified · Split
| @@ -49,7 +49,8 @@ impl ProgramKind { · 48 unmodified lines | |||
| 49 | prepare = prepare.arg("-batch"); | 49 | prepare = prepare.arg("-batch"); |
| 50 | } | 50 | } |
| 51 | if let Some(port) = url.port { | 51 | if let Some(port) = url.port { |
| 52 | prepare = prepare.arg(format!("-P{}", port)); | 52 | prepare = prepare.arg("-P"); |
| 53 | prepare = prepare.arg(port.to_string()); | ||
| 53 | } | 54 | } |
| 54 | } | 55 | } |
| 55 | ProgramKind::Simple => { | 56 | ProgramKind::Simple => { |
| @@ -134,14 +134,14 @@ mod program_kind { · 133 unmodified lines | |||
| 134 | fn tortoise_plink_has_batch_command() { | 134 | fn tortoise_plink_has_batch_command() { |
| 135 | assert_eq!( | 135 | assert_eq!( |
| 136 | call_args(ProgramKind::TortoisePlink, "ssh://user@host:42/p", Protocol::V2), | 136 | call_args(ProgramKind::TortoisePlink, "ssh://user@host:42/p", Protocol::V2), |
| 137 | quoted(&["tortoiseplink.exe", "-batch", "-P42", "user@host"]) | 137 | quoted(&["tortoiseplink.exe", "-batch", "-P", "42", "user@host"]) |
| 138 | ); | 138 | ); |
| 139 | } | 139 | } |
| 140 | 140 | ||
| 141 | #[test] | 141 | #[test] |
| 142 | fn port_for_all() { | 142 | fn port_for_all() { |
| 143 | for kind in [ProgramKind::TortoisePlink, ProgramKind::Plink, ProgramKind::Putty] { | 143 | for kind in [ProgramKind::TortoisePlink, ProgramKind::Plink, ProgramKind::Putty] { |
| 144 | assert!(call_args(kind, "ssh://user@host:43/p", Protocol::V2).ends_with(r#""-P43" "user@host""#)); | 144 | assert!(call_args(kind, "ssh://user@host:43/p", Protocol::V2).ends_with(r#""-P" "43" "user@host""#)); |
| 145 | } | 145 | } |
| 146 | } | 146 | } |
| 147 | 147 | ||