mirror of
https://github.com/nushell/nushell.git
synced 2025-08-09 04:45:04 +02:00
Temporarily(?) switch from heim+uom to sysinfo (#2954)
* Switch from heim to sysinfo * WIP * more cleanup * fmt * lint
This commit is contained in:
@ -1,5 +1,6 @@
|
||||
use nu_protocol::{outln, CallInfo, Value};
|
||||
use nu_protocol::{CallInfo, Value};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::io::Write;
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct JsonRpc<T> {
|
||||
@ -22,10 +23,16 @@ pub fn send_response<T: Serialize>(result: T) {
|
||||
let response = JsonRpc::new("response", result);
|
||||
let response_raw = serde_json::to_string(&response);
|
||||
|
||||
let mut stdout = std::io::stdout();
|
||||
|
||||
match response_raw {
|
||||
Ok(response) => outln!("{}", response),
|
||||
Err(err) => outln!("{}", err),
|
||||
}
|
||||
Ok(response) => {
|
||||
let _ = writeln!(stdout, "{}", response);
|
||||
}
|
||||
Err(err) => {
|
||||
let _ = writeln!(stdout, "{}", err);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
|
Reference in New Issue
Block a user