diff --git a/.travis.yml b/.travis.yml index 187c68f..1c8b939 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,8 +1,8 @@ language: rust cache: cargo rust: + - stable - nightly - # - stable # would fail, std::process::id is unstable matrix: allow_failures: diff --git a/Cargo.toml b/Cargo.toml index 72e455c..048ebdb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,6 +19,7 @@ serde_derive = "^1.0" serde_json = "^1.0" byte = "0.2" log = "~0.4" +libc = "0.2.39" # until std::process::id is stable [dependencies.uuid] version = "^0.6.2" diff --git a/src/lib.rs b/src/lib.rs index 74a9854..867af41 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,5 +1,3 @@ -#![feature(getpid)] - #[macro_use] extern crate log; #[macro_use] @@ -8,6 +6,7 @@ extern crate serde; extern crate serde_json; extern crate byte; extern crate uuid; +extern crate libc; #[macro_use] mod macros; diff --git a/src/models/set_activity.rs b/src/models/set_activity.rs index eef9c62..61ad8a1 100644 --- a/src/models/set_activity.rs +++ b/src/models/set_activity.rs @@ -1,4 +1,4 @@ -use std::process::id as pid; +use libc::getpid; use models::Command; #[derive(Debug, Default, Serialize)] @@ -10,7 +10,7 @@ pub struct SetActivityArgs { impl SetActivityArgs { pub fn command(args: SetActivity) -> Command { Command::new("SET_ACTIVITY", Self { - pid: pid(), + pid: unsafe { getpid() as u32 }, activity: args }) }