summaryrefslogtreecommitdiff
path: root/tool
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2022-12-25 00:43:27 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2022-12-25 00:43:27 +0900
commit3cbe37bd357464c0ce665770998b691cad022a24 (patch)
treebfe81fb137f617773a900c7b3fb588b682bb85ad /tool
parent4378de02f9c2c494ae1302c59625e2d126b23f3e (diff)
Support new style diagnostic reports
Diffstat (limited to 'tool')
-rw-r--r--tool/lib/envutil.rb18
1 files changed, 13 insertions, 5 deletions
diff --git a/tool/lib/envutil.rb b/tool/lib/envutil.rb
index e21305c9ef..728ca7059b 100644
--- a/tool/lib/envutil.rb
+++ b/tool/lib/envutil.rb
@@ -297,16 +297,24 @@ module EnvUtil
cmd = @ruby_install_name if "ruby-runner#{RbConfig::CONFIG["EXEEXT"]}" == cmd
path = DIAGNOSTIC_REPORTS_PATH
timeformat = DIAGNOSTIC_REPORTS_TIMEFORMAT
- pat = "#{path}/#{cmd}_#{now.strftime(timeformat)}[-_]*.crash"
+ pat = "#{path}/#{cmd}_#{now.strftime(timeformat)}[-_]*.{crash,ips}"
first = true
30.times do
first ? (first = false) : sleep(0.1)
Dir.glob(pat) do |name|
log = File.read(name) rescue next
- if /\AProcess:\s+#{cmd} \[#{pid}\]$/ =~ log
- File.unlink(name)
- File.unlink("#{path}/.#{File.basename(name)}.plist") rescue nil
- return log
+ case name
+ when /\.crash\z/
+ if /\AProcess:\s+#{cmd} \[#{pid}\]$/ =~ log
+ File.unlink(name)
+ File.unlink("#{path}/.#{File.basename(name)}.plist") rescue nil
+ return log
+ end
+ when /\.ips\z/
+ if /^ *"pid" *: *#{pid},/ =~ log
+ File.unlink(name)
+ return log
+ end
end
end
end