Refactor env logging common usages with a module

This commit is contained in:
Thibault Jouan
2015-04-18 18:04:05 +00:00
parent 5a102e7739
commit a9466a49f0
5 changed files with 33 additions and 15 deletions

View File

@@ -1,6 +1,8 @@
module Uh
module WM
class ActionsHandler
include EnvLogging
def initialize env, events
@env, @events = env, events
end
@@ -14,14 +16,14 @@ module Uh
end
def execute command
@env.log "Execute: #{command}"
log "Execute: #{command}"
pid = fork do
fork do
Process.setsid
begin
exec command
rescue Errno::ENOENT => e
@env.log_error "ExecuteError: #{e}"
log_error "ExecuteError: #{e}"
end
end
end