Browse files

sync the stdout and stdin

  • Loading branch information...
1 parent e2a9647 commit 31c933584ac6c564af675e9eb084f1619dff8be9 @gnufied committed Jan 4, 2009
Showing with 10 additions and 6 deletions.
  1. +3 −3 bin/runner.rb
  2. +7 −3 lib/packet/packet_master.rb
View
6 bin/runner.rb
@@ -37,10 +37,10 @@ def show_result p_data
def connection_completed
puts "calling connection completed"
- #add_periodic_timer(4) { send_data("hello\n")}
+ # add_periodic_timer(4) { send_data("hello\n")}
# start_worker(:worker => :dynamic1_worker, :job_key => :hello_world)
-# 100.times do |i|
-# thread_pool.defer(i) do |j|
+ # 100.times do |i|
+ # thread_pool.defer(i) do |j|
# puts "Starting work for #{j} : #{j.class}"
# sleep(1)
# puts "Work done for #{j}"
View
10 lib/packet/packet_master.rb
@@ -109,10 +109,14 @@ def fork_and_load(worker_klass,worker_options = { })
[worker_read_end,worker_write_end].each { |x| enable_nonblock(x) }
begin
if(ARGV[0] == 'start' && Object.const_defined?(:SERVER_LOGGER))
- log_file = File.open(SERVER_LOGGER,"a")
- [STDIN, STDOUT, STDERR].each {|desc| desc.reopen(log_file)}
+ STDOUT.sync = true
+ STDERR.sync = true
+ log_file = File.open(SERVER_LOGGER,"w+")
+ [STDOUT, STDERR].each {|desc| desc.reopen(log_file)}
end
- rescue; end
+ rescue
+ puts $!.backtrace
+ end
exec form_cmd_line(worker_read_end.fileno,worker_write_end.fileno,t_worker_name,option_dump_length)
end
Process.detach(pid)

0 comments on commit 31c9335

Please sign in to comment.