Module: Cognizant::System
- Extended by:
- System
- Included in:
- System
- Defined in:
- lib/cognizant/system.rb,
lib/cognizant/system/ps.rb,
lib/cognizant/system/signal.rb
Defined Under Namespace
Instance Method Summary collapse
Methods included from PS
Methods included from Signal
Instance Method Details
#mkdir(*directories) ⇒ Object
38 39 40 41 42 |
# File 'lib/cognizant/system.rb', line 38 def mkdir(*directories) [*directories].each do |directory| FileUtils.mkdir_p(File.(directory)) end end |
#pid_running?(pid) ⇒ Boolean
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/cognizant/system.rb', line 13 def pid_running?(pid) return false unless pid and pid != 0 signal(0, pid) # It's running since no exception was raised. true rescue Errno::ESRCH # No such process. false rescue Errno::EPERM # Probably running, but we're not allowed to pass signals. # TODO: Is this a sign of problems ahead? true else # Possibly running. true end |
#unlink_file(path) ⇒ Object
30 31 32 33 34 35 36 |
# File 'lib/cognizant/system.rb', line 30 def unlink_file(path) begin File.unlink(path) if path rescue Errno::ENOENT nil end end |