File: daemon.rs

package info (click to toggle)
rust-command-group 2.1.0-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 472 kB
  • sloc: makefile: 2
file content (22 lines) | stat: -rw-r--r-- 592 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
//! This example shows how to use the `group_spawn` method
//! to spawn a python server daemon in the background.
//!
//! NOTE: This example will not work on Windows, as the
//! `kill_on_drop` flag is not supported via this API.
//!
//! See the `kill_on_drop` example for a Windows-compatible
//! example.

use std::process::Stdio;

use command_group::AsyncCommandGroup;

#[tokio::main]
async fn main() {
	tokio::process::Command::new("python3")
		.args(&["-m", "http.server", "8000"])
		.stderr(Stdio::null())
		.stdout(Stdio::null())
		.group_spawn()
		.expect("failed to spawn server");
}