Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Make backtrace-sanitizer fail more gracefully: if readlink fails then…

… print a warning and the original input.
  • Loading branch information...
commit 72f9473edd461f4d6b6d05387bc3ed6d2cd0e095 1 parent 815f6e3
Hongli Lai FooBarWidget authored
Showing with 15 additions and 1 deletion.
  1. +15 −1 helper-scripts/backtrace-sanitizer.rb
16 helper-scripts/backtrace-sanitizer.rb
View
@@ -40,11 +40,25 @@ def close
end
end
+def passthrough(input, output)
+ while !input.eof?
+ data = input.readline
+ output.write(data)
+ output.flush
+ end
+end
+
input = STDIN
output = STDERR
argv0, pid_or_filename = ARGV
if pid_or_filename =~ /\A\d+\Z/
- exe_filename = File.expand_path(File.readlink("/proc/#{pid_or_filename}/exe"))
+ begin
+ exe_filename = File.expand_path(File.readlink("/proc/#{pid_or_filename}/exe"))
+ rescue Errno::ENOENT, Errno::EACCES => e
+ warn "*** backtrace-sanitizer warning: #{e} -> passthrough input"
+ passthrough(input, output)
+ exit
+ end
else
exe_filename = File.expand_path(pid_or_filename)
end
Please sign in to comment.
Something went wrong with that request. Please try again.