summaryrefslogtreecommitdiff
path: root/code/snippets/if_fork_pid.rb
diff options
context:
space:
mode:
Diffstat (limited to 'code/snippets/if_fork_pid.rb')
-rw-r--r--code/snippets/if_fork_pid.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/code/snippets/if_fork_pid.rb b/code/snippets/if_fork_pid.rb
new file mode 100644
index 0000000..2c3c262
--- /dev/null
+++ b/code/snippets/if_fork_pid.rb
@@ -0,0 +1,8 @@
+puts "parent process pid is #{Process.pid}"
+
+if fork
+ puts "entered the if block from #{Process.pid}"
+else
+ puts "entered the else block from #{Process.pid}"
+end
+