Skip to content

Commit 350a27f

Browse files
committed
Fix Windows build: conditionally import spawn_unix
1 parent 5d5b618 commit 350a27f

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

sqlite-watcher/src/main.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ use std::time::Duration;
44
use anyhow::{bail, Context, Result};
55
use clap::{Parser, Subcommand, ValueEnum};
66
use sqlite_watcher::queue::{ChangeOperation, ChangeQueue, NewChange};
7-
use sqlite_watcher::server::{spawn_tcp, spawn_unix};
7+
use sqlite_watcher::server::spawn_tcp;
8+
#[cfg(unix)]
9+
use sqlite_watcher::server::spawn_unix;
810
use tokio::signal;
911

1012
#[derive(Parser)]
@@ -98,7 +100,10 @@ async fn serve(queue_db: Option<PathBuf>, listen: &str, token_file: Option<PathB
98100
.context("invalid tcp address")?;
99101
spawn_tcp(addr, queue.path().to_path_buf(), token)?
100102
}
103+
#[cfg(unix)]
101104
WatcherEndpoint::Unix(path) => spawn_unix(&path, queue.path().to_path_buf(), token)?,
105+
#[cfg(not(unix))]
106+
WatcherEndpoint::Unix(_) => bail!("Unix sockets are not supported on Windows. Use tcp:host:port instead."),
102107
WatcherEndpoint::Pipe(name) => bail!("named pipes are not yet supported ({name})"),
103108
};
104109
println!("Press Ctrl+C to stop sqlite-watcher");

0 commit comments

Comments
 (0)