Skip to content

Commit

Permalink
simple check: proxy program start/stop
Browse files Browse the repository at this point in the history
  • Loading branch information
slivingston committed Sep 22, 2024
1 parent 8e38f7a commit 05080ff
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

use std::process::Command;
use std::process::{Command, Stdio};

use crate::mgmt::{self, CProvider, Config, WDeployment};
use crate::{api, camera, control, monitor};
Expand Down Expand Up @@ -103,6 +103,18 @@ pub fn check_proxy(wd: &WDeployment) -> Result<(), String> {
"Proxy is not configured. Try `hardshare config --assign-proxy-command`".into(),
);
}
let mut child = match Command::new(&wd.cargs[0])
.args(wd.cargs[1..].iter())
.stdout(Stdio::piped())
.spawn()
{
Ok(c) => c,
Err(err) => return Err(err.to_string()),
};
match child.kill() {
Ok(()) => (),
Err(err) => return Err(err.to_string()),
}
Ok(())
}

Expand Down

0 comments on commit 05080ff

Please sign in to comment.