Skip to content

Commit dfda1d7

Browse files
committed
Disable windows portions for now
1 parent 4483751 commit dfda1d7

File tree

5 files changed

+49
-32
lines changed

5 files changed

+49
-32
lines changed

src/daemon/src/connection.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
use lsp_message::LspMessage;
2+
use std::io;
3+
#[cfg(target_family = "unix")]
4+
use std::io::BufReader;
25
#[cfg(target_family = "unix")]
36
use std::os::unix::net::UnixStream;
47
#[cfg(target_family = "unix")]
58
use std::sync::Mutex;
6-
use std::{io, io::BufReader};
79

810
pub struct Connection {
911
#[cfg(target_family = "unix")]
@@ -30,6 +32,9 @@ impl Connection {
3032
}
3133

3234
#[cfg(target_family = "windows")]
33-
panic!("Windows is not supported")
35+
{
36+
let _ = message;
37+
panic!("Windows is not supported")
38+
}
3439
}
3540
}

src/daemon/src/daemon.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@ use crate::Queue;
22
use lsp_message::LspMessage;
33
#[cfg(target_family = "unix")]
44
use std::os::unix::net::UnixListener;
5+
#[cfg(target_family = "unix")]
6+
use std::os::unix::net::UnixStream;
57
use std::{
68
io::{self, BufReader},
7-
os::unix::net::UnixStream,
89
sync::atomic::{AtomicBool, Ordering},
910
};
1011

src/daemon/src/lib.rs

Lines changed: 30 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,14 @@ mod logger;
44
mod queue;
55

66
pub use crate::{connection::Connection, daemon::Daemon};
7+
#[cfg(target_family = "unix")]
78
use lsp_message::LspMessage;
89
pub use queue::*;
910
#[cfg(target_family = "unix")]
1011
use std::os::unix::net::{SocketAddr, UnixStream};
11-
use std::{
12-
io::{self, BufReader, ErrorKind},
13-
sync::Arc,
14-
time::Duration,
15-
};
12+
use std::{io, sync::Arc};
13+
#[cfg(target_family = "unix")]
14+
use std::{io::BufReader, io::ErrorKind, time::Duration};
1615

1716
pub fn main_loop(daemon: Daemon) -> io::Result<()> {
1817
let daemon = Arc::new(daemon);
@@ -21,36 +20,38 @@ pub fn main_loop(daemon: Daemon) -> io::Result<()> {
2120
eprintln!("Failed to create daemon log file");
2221
}
2322

24-
daemon
25-
.listener
26-
.set_nonblocking(true)
27-
.expect("Failed to set to non-blocking");
23+
#[cfg(target_family = "unix")]
24+
{
25+
daemon
26+
.listener
27+
.set_nonblocking(true)
28+
.expect("Failed to set to non-blocking");
2829

29-
// Executor thread
30-
std::thread::spawn(|| {});
30+
// Executor thread
31+
std::thread::spawn(|| {});
3132

32-
// Accept clients
33-
#[cfg(target_family = "unix")]
34-
loop {
35-
match daemon.listener.accept() {
36-
Ok((stream, address)) => {
37-
let daemon = Arc::clone(&daemon);
38-
std::thread::spawn(move || handle_client(daemon, stream, address));
39-
}
40-
Err(error) => {
41-
if let io::ErrorKind::WouldBlock = error.kind() {
42-
// No clients ready to connect to us yet
43-
} else {
44-
log::error!("Failed to accept client: {:?}", error);
33+
// Accept clients
34+
loop {
35+
match daemon.listener.accept() {
36+
Ok((stream, address)) => {
37+
let daemon = Arc::clone(&daemon);
38+
std::thread::spawn(move || handle_client(daemon, stream, address));
39+
}
40+
Err(error) => {
41+
if let io::ErrorKind::WouldBlock = error.kind() {
42+
// No clients ready to connect to us yet
43+
} else {
44+
log::error!("Failed to accept client: {:?}", error);
45+
}
4546
}
4647
}
47-
}
4848

49-
if daemon.should_exit() {
50-
return Ok(());
51-
}
49+
if daemon.should_exit() {
50+
return Ok(());
51+
}
5252

53-
std::thread::sleep(Duration::from_millis(50));
53+
std::thread::sleep(Duration::from_millis(50));
54+
}
5455
}
5556

5657
#[cfg(target_family = "windows")]

src/lambda/Cargo.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[package]
2+
name = "lambda"
3+
version = "0.1.0"
4+
edition = "2024"
5+
6+
[dependencies]
7+

src/lambda/src/main.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
fn main() -> Result<(), Box<dyn Error>> {
2+
Ok(())
3+
}

0 commit comments

Comments
 (0)