diff options
author | Wez Furlong <wez@wezfurlong.org> | 2019-12-03 08:52:12 -0800 |
---|---|---|
committer | Wez Furlong <wez@wezfurlong.org> | 2019-12-08 09:09:38 -0800 |
commit | 7cb3d36aedac87cdfa25b4c60e155d1e0e88a512 (patch) | |
tree | a12237e340108f11ac26046b24e116f34f1f8680 /tests | |
parent | 692f5d77e199f8065998223f49a0f790adebc226 (diff) | |
download | ssh2-rs-7cb3d36aedac87cdfa25b4c60e155d1e0e88a512.zip |
A PtyModes helper for specifying terminal modes
Closes: https://github.com/alexcrichton/ssh2-rs/issues/145
Diffstat (limited to 'tests')
-rw-r--r-- | tests/all/channel.rs | 21 | ||||
-rwxr-xr-x | tests/run_integration_tests.sh | 2 |
2 files changed, 22 insertions, 1 deletions
diff --git a/tests/all/channel.rs b/tests/all/channel.rs index 660c72d..8b624ac 100644 --- a/tests/all/channel.rs +++ b/tests/all/channel.rs @@ -220,3 +220,24 @@ fn exit_code_ignores_other_errors() { assert!(sess.disconnect(None, &longdescription, None).is_err()); // max len == 256 assert!(channel.exit_status().unwrap() == 0); } + +#[test] +fn pty_modes_are_propagated() { + let sess = ::authed_session(); + let mut channel = sess.channel_session().unwrap(); + eprintln!("requesting pty"); + + let mut mode = ssh2::PtyModes::new(); + // intr is typically CTRL-C; setting it to unmodified `y` + // should be very high signal that it took effect + mode.set_character(ssh2::PtyModeOpcode::VINTR, Some('y')); + + channel.request_pty("xterm", Some(mode), None).unwrap(); + channel.exec("stty -a").unwrap(); + + let (out, _err) = consume_stdio(&mut channel); + channel.close().unwrap(); + + // This may well be linux specific + assert!(out.contains("intr = y"), "mode was propagated"); +} diff --git a/tests/run_integration_tests.sh b/tests/run_integration_tests.sh index 451fbec..02d132d 100755 --- a/tests/run_integration_tests.sh +++ b/tests/run_integration_tests.sh @@ -31,7 +31,7 @@ cp $SSHDIR/id_rsa.pub $SSHDIR/authorized_keys ssh-keygen -f $SSHDIR/ssh_host_rsa_key -N '' -t rsa -for p in /usr/lib/openssh/sftp-server /usr/libexec/sftp-server ; do +for p in /usr/lib/openssh/sftp-server /usr/libexec/sftp-server /usr/libexec/openssh/sftp-server ; do if test -x $p ; then SFTP=$p fi |