myrmidon 0.0.1

Remote cmd / shell handler
Documentation
use std::{io::Read, process::{Command, Stdio}};

use myrmidon_types::TaskStatus;

use super::Task;

impl Task{
  pub(crate) fn start(&mut self){
    // let mut cmd = Command::new("cmd");

    // self.get_commands().iter().for_each(|command|{
    //   let arg = vec![command.get_name().clone()].join(" ");

    //   let output = cmd.arg(arg)
    //     // Tell the OS to record the command's output
    //     .stdout(Stdio::piped())
    //     // execute the command, wait for it to complete, then capture the output
    //     .output()
    //     // Blow up if the OS was unable to start the program
    //     .unwrap();

    //   // extract the raw bytes that we captured and interpret them as a string
    //   let stdout = String::from_utf8(output.stdout).unwrap();

    //   println!("{}", stdout);

    //   let mut child = cmd.spawn().unwrap();

    //   let mut test: String = String::new();

    //   // extract the raw bytes that we captured and interpret them as a string
    //   let stdout = child.stdout.take().unwrap().read_to_string(&mut test);

    //   println!("{:?}", test);

    //   // http://github.com/matklad/xshell
    // });

    self.set_status(TaskStatus::Running);
  }
  pub(crate) fn stop(&mut self){
    self.set_status(TaskStatus::Stopped);
  }
}