Skip to content

Commit 65197e0

Browse files
authored
Merge pull request #60 from NobodyXu/prepare-support-for-windows
Prepare support for windows
2 parents 9f42dbf + 44fd5dc commit 65197e0

File tree

4 files changed

+13
-0
lines changed

4 files changed

+13
-0
lines changed

src/builder.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,8 @@ impl SessionBuilder {
127127
/// be created.
128128
///
129129
/// If not set, `./` will be used (the current directory).
130+
#[cfg(not(windows))]
131+
#[cfg_attr(docsrs, doc(cfg(not(windows))))]
130132
pub fn control_directory(&mut self, p: impl AsRef<Path>) -> &mut Self {
131133
self.control_dir = Some(p.as_ref().to_path_buf());
132134
self

src/changelog.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ use crate::*;
1717
/// - Remove accidentally exposed `TryFrom<tokio_pipe::PipeRead>`
1818
/// implementation for [`ChildStderr`].
1919
#[doc(hidden)]
20+
/// ## Changed
21+
/// - Make [`Session::check`] available only on unix.
22+
/// - Make [`Socket::UnixSocket`] available only on unix.
23+
/// - Make [`SessionBuilder::control_directory`] available only on unix.
2024
pub mod unreleased {}
2125

2226
/// ## Fixed

src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,8 @@ impl Session {
289289
}
290290

291291
/// Check the status of the underlying SSH connection.
292+
#[cfg(not(windows))]
293+
#[cfg_attr(docsrs, doc(cfg(not(windows))))]
292294
pub async fn check(&self) -> Result<(), Error> {
293295
delegate!(&self.0, imp, { imp.check().await })
294296
}

src/port_forwarding.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ impl From<ForwardType> for native_mux_impl::ForwardType {
3636
#[derive(Clone, Debug, Eq, PartialEq, Hash)]
3737
pub enum Socket<'a> {
3838
/// Unix socket.
39+
#[cfg(unix)]
40+
#[cfg_attr(docsrs, doc(cfg(unix)))]
3941
UnixSocket {
4042
/// Filesystem path
4143
path: Cow<'a, Path>,
@@ -59,6 +61,7 @@ impl Socket<'_> {
5961
#[cfg(feature = "process-mux")]
6062
pub(crate) fn as_os_str(&self) -> Cow<'_, OsStr> {
6163
match self {
64+
#[cfg(unix)]
6265
Socket::UnixSocket { path } => Cow::Borrowed(path.as_os_str()),
6366
Socket::TcpSocket(socket) => Cow::Owned(format!("{}", socket).into()),
6467
}
@@ -71,6 +74,7 @@ impl<'a> From<Socket<'a>> for native_mux_impl::Socket<'a> {
7174
use native_mux_impl::Socket::*;
7275

7376
match socket {
77+
#[cfg(unix)]
7478
Socket::UnixSocket { path } => UnixSocket { path },
7579
Socket::TcpSocket(socket) => TcpSocket {
7680
port: socket.port() as u32,
@@ -83,6 +87,7 @@ impl<'a> From<Socket<'a>> for native_mux_impl::Socket<'a> {
8387
impl<'a> fmt::Display for Socket<'a> {
8488
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
8589
match self {
90+
#[cfg(unix)]
8691
Socket::UnixSocket { path } => {
8792
write!(f, "{}", path.to_string_lossy())
8893
}

0 commit comments

Comments
 (0)