Use libc::getpid instead of std::process::id

Until the std::process::id interface becomes stable.
This commit is contained in:
Patrick Auernig 2018-03-23 11:04:19 +01:00
parent 6d83bc0af2
commit 0e38bf634d
4 changed files with 5 additions and 5 deletions

View File

@ -1,8 +1,8 @@
language: rust
cache: cargo
rust:
- stable
- nightly
# - stable # would fail, std::process::id is unstable
matrix:
allow_failures:

View File

@ -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"

View File

@ -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;

View File

@ -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<Self> {
Command::new("SET_ACTIVITY", Self {
pid: pid(),
pid: unsafe { getpid() as u32 },
activity: args
})
}