Skip to content

Commit 0a9ea55

Browse files
committed
Daemon - make log writing less brittle
1 parent 4389a8e commit 0a9ea55

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

app/server/ruby/bin/daemon.rb

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,14 @@ def boot
412412
@stdin, @stdout_and_err, @wait_thr = Open3.popen2e @cmd, *@args
413413
@pid = @wait_thr.pid
414414
@io_thr = Thread.new do
415-
@stdout_and_err.each {|line| @log_file << line ; @log_file.flush}
415+
@stdout_and_err.each do |line|
416+
begin
417+
@log_file << line
418+
@log_file.flush
419+
rescue IOError
420+
# don't attempt to write
421+
end
422+
end
416423
end
417424
end
418425

@@ -430,6 +437,7 @@ def wait
430437
end
431438

432439
def kill
440+
433441
if process_running?
434442
Util.log "Process Booter - killing #{@cmd} with pid #{@pid} and args #{@args.inspect}, wait_thr status: #{@wait_thr}, #{@wait_thr.status}"
435443

0 commit comments

Comments
 (0)