aboutsummaryrefslogtreecommitdiff
path: root/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/lib.rs b/src/lib.rs
index ee77aa4..58c1e0c 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -222,7 +222,7 @@ enum ChildState {
Exited(ExitStatus),
}
-use ChildState::*;
+use crate::ChildState::*;
#[cfg(test)]
mod tests {
@@ -231,12 +231,27 @@ mod tests {
use std::process::Command;
use std::sync::Arc;
+ // Python isn't available on some Unix platforms, e.g. Android, so we need this instead.
+ #[cfg(unix)]
+ pub fn true_cmd() -> Command {
+ Command::new("true")
+ }
+
+ #[cfg(not(unix))]
pub fn true_cmd() -> Command {
let mut cmd = Command::new("python");
cmd.arg("-c").arg("");
cmd
}
+ #[cfg(unix)]
+ pub fn sleep_forever_cmd() -> Command {
+ let mut cmd = Command::new("sleep");
+ cmd.arg("1000000");
+ cmd
+ }
+
+ #[cfg(not(unix))]
pub fn sleep_forever_cmd() -> Command {
let mut cmd = Command::new("python");
cmd.arg("-c").arg("import time; time.sleep(1000000)");