From 5b1fe5d6b56ef80e6cecc8a0b99398cce4ec4042 Mon Sep 17 00:00:00 2001 From: nbari Date: Thu, 1 Feb 2024 17:37:30 +0100 Subject: [PATCH] update example --- README.md | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 1ddc14b..8609175 100644 --- a/README.md +++ b/README.md @@ -18,15 +18,19 @@ Example: Create a new test project: - $ cargo new --bin fork + $ cargo new --bin myapp > To install `cargo` use: `curl https://sh.rustup.rs -sSf | sh` -Edit `fork/Cargo.toml` and add to `[dependencies]`: +Add `fork` as a depdendecie: + + cargo add fork + +or Edit `myapp/Cargo.toml` and add to `[dependencies]`: fork = "0.1" -Add the following code to `fork/main.rs` +Add the following code to `myapp/main.rs` ```rs use fork::{daemon, Fork}; @@ -50,7 +54,7 @@ Test running: Use `ps` to check the process, for example: - $ ps -axo ppid,pid,pgid,sess,tty,tpgid,stat,uid,%mem,%cpu,command, | egrep "fork|sleep|PID" + $ ps -axo ppid,pid,pgid,sess,tty,tpgid,stat,uid,%mem,%cpu,command, | egrep "myapp|sleep|PID" > `egrep` is used to show the `ps` headers @@ -58,7 +62,7 @@ Output should be something like: ```pre PPID PID PGID SESS TTY TPGID STAT UID %MEM %CPU COMMAND - 1 48738 48737 0 ?? 0 S 501 0.0 0.0 target/debug/fork + 1 48738 48737 0 ?? 0 S 501 0.0 0.0 target/debug/myapp 48738 48753 48737 0 ?? 0 S 501 0.0 0.0 sleep 300 ``` @@ -67,5 +71,5 @@ Output should be something like: * new `PGID = 48737` 1 - root (init/launchd) - \-- 48738 fork PGID - 48737 + \-- 48738 myapp PGID - 48737 \--- 48753 sleep PGID - 48737