|
1 | 1 | use std::sync::{mpsc, Arc, atomic::{AtomicI32, self}};
|
2 | 2 |
|
3 | 3 | use log::{warn, info, debug};
|
4 |
| -use anyhow::Result; |
| 4 | +use anyhow::{Result, Context}; |
5 | 5 | use serde_json as json;
|
6 | 6 |
|
7 | 7 | use crate::{rpcio, bytecode::{self, BytecodeOptions}};
|
@@ -122,28 +122,36 @@ pub fn run_app_forever(client_reader: impl std::io::Read + Send + 'static,
|
122 | 122 | let proc_stdin = proc.stdin.take().unwrap();
|
123 | 123 | std::thread::spawn(move || {
|
124 | 124 | debug!("Started client->server write thread");
|
125 |
| - process_channel_to_writer(c2s_channel_sub, Some(c2s_channel_counter), proc_stdin).unwrap(); |
| 125 | + process_channel_to_writer(c2s_channel_sub, Some(c2s_channel_counter), proc_stdin) |
| 126 | + .with_context(|| "Client->server write thread failed") |
| 127 | + .unwrap(); |
126 | 128 | debug!("Finished client->server write thread");
|
127 | 129 | });
|
128 | 130 | }
|
129 | 131 | std::thread::spawn(move || {
|
130 | 132 | debug!("Started server->client write thread");
|
131 |
| - process_channel_to_writer(s2c_channel_sub, None, client_writer).unwrap(); |
| 133 | + process_channel_to_writer(s2c_channel_sub, None, client_writer) |
| 134 | + .with_context(|| "Server->client write thread failed") |
| 135 | + .unwrap(); |
132 | 136 | debug!("Finished server->client write thread");
|
133 | 137 | });
|
134 | 138 | {
|
135 | 139 | let s2c_channel_pub = s2c_channel_pub.clone();
|
136 | 140 | let proc_stdout = proc.stdout.take().unwrap();
|
137 | 141 | std::thread::spawn(move || {
|
138 | 142 | debug!("Started server->client read thread");
|
139 |
| - process_server_reader(proc_stdout, s2c_channel_pub, options.bytecode_options).unwrap(); |
| 143 | + process_server_reader(proc_stdout, s2c_channel_pub, options.bytecode_options) |
| 144 | + .with_context(|| "Server->client read thread failed") |
| 145 | + .unwrap(); |
140 | 146 | debug!("Finished server->client read thread");
|
141 | 147 | });
|
142 | 148 | }
|
143 | 149 | std::thread::spawn(move || {
|
144 | 150 | debug!("Started client->server read thread");
|
145 | 151 | process_client_reader(
|
146 |
| - client_reader, c2s_channel_pub, c2s_channel_counter, s2c_channel_pub).unwrap(); |
| 152 | + client_reader, c2s_channel_pub, c2s_channel_counter, s2c_channel_pub) |
| 153 | + .with_context(|| "Client->server read thread failed") |
| 154 | + .unwrap(); |
147 | 155 | debug!("Finished client->server read thread");
|
148 | 156 | });
|
149 | 157 |
|
|
0 commit comments