From c3725511aba85f2422b09b5aa1aacf2b89aa7b77 Mon Sep 17 00:00:00 2001 From: bnewbold Date: Wed, 12 Oct 2016 22:54:12 -0700 Subject: fix 'help' command --- src/bin/einhyrningsinsctl.rs | 2 +- src/main.rs | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/bin/einhyrningsinsctl.rs b/src/bin/einhyrningsinsctl.rs index 7782be3..a727c2f 100644 --- a/src/bin/einhyrningsinsctl.rs +++ b/src/bin/einhyrningsinsctl.rs @@ -53,7 +53,7 @@ fn shell(ctrl_stream: UnixStream) { println!(""); println!("Welcome to the einhyrningsins shell!"); - println!("Try 'help if you need it"); + println!("Try 'help' if you need it"); loop { let readline = rl.readline("> "); diff --git a/src/main.rs b/src/main.rs index 2e85ab5..e7f4fe5 100644 --- a/src/main.rs +++ b/src/main.rs @@ -642,7 +642,7 @@ fn init(cfg: EinConfig, ctrl_req_rx: Receiver) -> Result) { let reader = BufReader::new(&stream); @@ -702,7 +702,12 @@ fn ctrl_socket_handle(stream: UnixStream, ctrl_req_tx: Sender) { continue; }, Some("help") => { - writer.write_all(CTRL_SHELL_USAGE.as_bytes()).unwrap(); // TODO + //let escaped = json::JsonValue::String(CTRL_SHELL_USAGE.to_string()); + //writer.write_all(json::stringify(escaped).as_bytes()).unwrap(); + + let escaped = json::stringify(json::JsonValue::from(CTRL_SHELL_USAGE)); + writer.write_all(escaped.as_bytes()).unwrap(); + writer.write_all("\n".as_bytes()).unwrap(); writer.flush().unwrap(); continue; }, -- cgit v1.2.3