diff options
| author | Eskil Queseth <eskilq@kth.se> | 2020-10-15 21:21:55 +0200 |
|---|---|---|
| committer | Eskil Queseth <eskilq@kth.se> | 2020-10-15 21:21:55 +0200 |
| commit | 01b3c75420ec5bf9083dbcf643d3c6087d4f2ce7 (patch) | |
| tree | 4a6dd760ad39974fc8684fe76400b5dee8967c37 /mumctl/src/main.rs | |
| parent | 680c46e6866071ae987d9978316ce2952347fe35 (diff) | |
| parent | 47d3834a6e5b82e287b975fbf55939c6fd44ca02 (diff) | |
| download | mum-01b3c75420ec5bf9083dbcf643d3c6087d4f2ce7.tar.gz | |
Merge remote-tracking branch 'origin/cli' into error-handling
Diffstat (limited to 'mumctl/src/main.rs')
| -rw-r--r-- | mumctl/src/main.rs | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/mumctl/src/main.rs b/mumctl/src/main.rs index e7a11a9..403447f 100644 --- a/mumctl/src/main.rs +++ b/mumctl/src/main.rs @@ -1,3 +1,33 @@ +use ipc_channel::ipc::{self, IpcReceiver, IpcSender}; +use log::*; +use mumlib::command::{Command, CommandResponse}; +use mumlib::setup_logger; +use std::fs; + fn main() { - println!("Hello, world!"); + setup_logger(); + + // MUMCTL + //temp send command and channel to listener + debug!("Creating channel"); + let (tx_client, rx_client): (IpcSender<Result<Option<CommandResponse>, ()>>, + IpcReceiver<Result<Option<CommandResponse>, ()>>) = ipc::channel().unwrap(); + + let server_name = fs::read_to_string("/var/tmp/mumd-oneshot").unwrap(); //TODO don't panic + debug!("Connecting to mumd at {}", server_name); + let tx0 = IpcSender::connect(server_name).unwrap(); + let connect_command = Command::ServerConnect { + host: "10.0.0.10".to_string(), + port: 64738u16, + username: "gustav-mumd".to_string(), + accept_invalid_cert: true, + }; + debug!("Sending {:?} to mumd", connect_command); + tx0.send(( + connect_command, + tx_client)) .unwrap(); + + debug!("Reading response"); + let response = rx_client.recv().unwrap(); + debug!("{:?}", response); } |
