Skip to content

Commit 8a5ddfa

Browse files
svenstaroMatheus Xavier
authored andcommitted
Modernize examples and give them slightly better names
There's no need to prefix examples with example- as they are already in the examples/ dir.
1 parent de3c729 commit 8a5ddfa

File tree

3 files changed

+8
-12
lines changed

3 files changed

+8
-12
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
Rust library to ease the task of creating daemons, I have drawn heavy inspiration from [Daemonize by knsd](https://github.com/knsd/daemonize).
33

44
# Current releases and EOL table
5+
56
| track | version | EOL |
67
|----------|---------|---------|
78
| 2.0 | 2.0.1 | TBA |
@@ -13,7 +14,7 @@ Add it to your cargo.toml this will add the whole 2.0.x series as compatible as
1314
```toml
1415
daemonize-me = "2.0"
1516
```
16-
Then look at [example.rs](examples/example.rs)
17+
Then look at [hooks.rs](examples/hooks.rs)
1718

1819

1920
## OS support
@@ -41,4 +42,4 @@ Licensed under either of
4142

4243
# Contribution
4344

44-
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you shall be dual licensed as above, without any additional terms or conditions.
45+
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you shall be dual licensed as above, without any additional terms or conditions.
Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
1-
extern crate daemonize_me;
2-
31
use std::any::Any;
42
use std::fs::File;
53
use std::process::exit;
64

7-
pub use daemonize_me::Daemon;
8-
5+
use daemonize_me::Daemon;
96

107
fn post_fork_parent(ppid: i32, cpid: i32) -> ! {
118
println!("Parent pid: {}, Child pid {}", ppid, cpid);
@@ -18,12 +15,12 @@ fn post_fork_child(ppid: i32, cpid: i32) {
1815
println!("Parent pid: {}, Child pid {}", ppid, cpid);
1916
println!("This hook is called in the child");
2017
// Child hook must return
21-
return
18+
return;
2219
}
2320

2421
fn after_init(_: Option<&dyn Any>) {
2522
println!("Initialized the daemon!");
26-
return
23+
return;
2724
}
2825

2926
fn main() {
@@ -47,7 +44,7 @@ fn main() {
4744
Err(e) => {
4845
eprintln!("Error, {}", e);
4946
exit(-1);
50-
},
47+
}
5148
}
5249

5350
for i in 0..=10000 {
Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
extern crate daemonize_me;
2-
31
use std::fs::File;
42

5-
pub use daemonize_me::{Daemon, User, Group};
3+
use daemonize_me::{Daemon, Group, User};
64

75
fn main() {
86
let stdout = File::create("info.log").unwrap();

0 commit comments

Comments
 (0)