Skip to content

Commit f44436a

Browse files
chewbrancadefunkt
authored andcommitted
Fix case of $0 truncating text due to being frozen
Fix failure on test "sets $0 while working" This appears to be an OS dependent issue. I ran into this on Ubuntu Linux 10.04 64bit on kernel 2.6.32-22 I do not know if this is an ideal solution, not did I come up with it. I found the solution at: http://www.ruby-forum.com/topic/187083#817010 but I do know that the tests now pass, so hopefully either this gets incorporated, or triggers the creation of a better solution.
1 parent b2d2998 commit f44436a

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

lib/resque/worker.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -456,6 +456,13 @@ def worker_pids
456456
# Procline is always in the format of:
457457
# resque-VERSION: STRING
458458
def procline(string)
459+
# Get around frozen $0
460+
# Thanks to: http://www.ruby-forum.com/topic/187083#817010
461+
$procline = $0
462+
alias $PROC_LINE $0
463+
alias $0 $procline
464+
trace_var(:$0) {|val| $PROC_LINE = val}
465+
459466
$0 = "resque-#{Resque::Version}: #{string}"
460467
log! $0
461468
end

0 commit comments

Comments
 (0)