Module: TaskJuggler::ProcessIntercomIface
Instance Method Summary
collapse
#critical, #debug, #error, #fatal, #info, #warning
Instance Method Details
#connect(authKey, stdout, stderr, stdin, silent) ⇒ Object
54
55
56
57
58
|
# File 'lib/taskjuggler/daemon/ProcessIntercom.rb', line 54
def connect(authKey, stdout, stderr, stdin, silent)
return false unless @server.checkKey(authKey, 'connect')
trap { @server.connect(stdout, stderr, stdin, silent) }
end
|
#disconnect(authKey) ⇒ Object
60
61
62
63
64
|
# File 'lib/taskjuggler/daemon/ProcessIntercom.rb', line 60
def disconnect(authKey)
return false unless @server.checkKey(authKey, 'disconnect')
trap { @server.disconnect }
end
|
#terminate(authKey) ⇒ Object
48
49
50
51
52
|
# File 'lib/taskjuggler/daemon/ProcessIntercom.rb', line 48
def terminate(authKey)
return false unless @server.checkKey(authKey, 'terminate')
trap { @server.terminate }
end
|
This function catches all unhandled exceptions in the passed block.
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
# File 'lib/taskjuggler/daemon/ProcessIntercom.rb', line 26
def trap
begin
MessageHandlerInstance.instance.trapSetup = true
res = yield
MessageHandlerInstance.instance.trapSetup = false
res
rescue => e
begin
fatal('pi_crash_trap', "#{e}\n#{e.backtrace.join("\n")}\n\n" +
"#{'*' * 79}\nYou have triggered a bug in " +
"#{AppConfig.softwareName} version #{AppConfig.version}!\n" +
"Please see the user manual on how to get this bug fixed!\n" +
"#{'*' * 79}\n")
rescue RuntimeError
@server.terminate
return false
end
end
end
|