Skip to content

Commit

Permalink
Do not crash if build process exits early
Browse files Browse the repository at this point in the history
See #837.
  • Loading branch information
pfoerster committed Jan 18, 2023
1 parent f60e9bd commit 1a47c8c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
9 changes: 5 additions & 4 deletions src/features/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ impl Command {
.recv(&line_receiver, |line| match line {
Ok(message) => {
let params = LogMessageParams { message, typ };
client.send_notification::<LogMessage>(params).unwrap();
let _ = client.send_notification::<LogMessage>(params);
false
}
Err(_) => true,
Expand Down Expand Up @@ -170,9 +170,10 @@ fn track_output(
);

thread::spawn(move || {
for line in reader.lines() {
sender.send(line.unwrap()).unwrap();
}
let _ = reader
.lines()
.flatten()
.try_for_each(|line| sender.send(line));
})
}

Expand Down
10 changes: 3 additions & 7 deletions src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -678,9 +678,7 @@ impl Server {
let client = self.client.clone();
self.build_internal(uri, move |status| {
let result = BuildResult { status };
client
.send_response(lsp_server::Response::new_ok(id, result))
.unwrap();
let _ = client.send_response(lsp_server::Response::new_ok(id, result));
})?;

Ok(())
Expand Down Expand Up @@ -710,7 +708,7 @@ impl Server {

let status = compiler.run();
if forward_search_after {
sender.send(InternalMessage::ForwardSearch(uri)).unwrap();
let _ = sender.send(InternalMessage::ForwardSearch(uri));
}

drop(guard);
Expand All @@ -727,9 +725,7 @@ impl Server {
let client = self.client.clone();
self.forward_search_internal(uri, Some(params.position), move |status| {
let result = ForwardSearchResult { status };
client
.send_response(lsp_server::Response::new_ok(id, result))
.unwrap();
let _ = client.send_response(lsp_server::Response::new_ok(id, result));
})?;

Ok(())
Expand Down

0 comments on commit 1a47c8c

Please sign in to comment.