aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbnewbold <bnewbold@robocracy.org>2016-10-12 22:54:12 -0700
committerbnewbold <bnewbold@robocracy.org>2016-10-12 22:54:12 -0700
commitc3725511aba85f2422b09b5aa1aacf2b89aa7b77 (patch)
tree9a08208c843e54209d988542789bec427feb2761
parentf24d5897071e8792402fcb2320fb4f1c1ec128ff (diff)
downloadeinhyrningsins-c3725511aba85f2422b09b5aa1aacf2b89aa7b77.tar.gz
einhyrningsins-c3725511aba85f2422b09b5aa1aacf2b89aa7b77.zip
fix 'help' command
-rw-r--r--src/bin/einhyrningsinsctl.rs2
-rw-r--r--src/main.rs11
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<CtrlRequest>) -> Result<EinState,
/* * * * * * * * Control Socket Server * * * * * * * */
-const CTRL_SHELL_USAGE: &'static str = r#"\"Command Listing:
+const CTRL_SHELL_USAGE: &'static str = r#"Command Listing:
inc increments number of children
dec decrements number of children
@@ -653,7 +653,7 @@ const CTRL_SHELL_USAGE: &'static str = r#"\"Command Listing:
status shows summary state of children
help prints this help message
version prints (master) version
-\"\n"#;
+"#;
fn ctrl_socket_handle(stream: UnixStream, ctrl_req_tx: Sender<CtrlRequest>) {
let reader = BufReader::new(&stream);
@@ -702,7 +702,12 @@ fn ctrl_socket_handle(stream: UnixStream, ctrl_req_tx: Sender<CtrlRequest>) {
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;
},