mirror of
https://github.com/etlegacy/Update-Installer.git
synced 2024-11-22 20:01:20 +00:00
Add -d option to the updater test script to run the updater binary under GDB.
Running the updater binary under a debugger makes it easier to attach to the process and set breakpoints in GDB than trying to start the ruby script itself under GDB and follow forks until the updater executes.
This commit is contained in:
parent
1bad51e3dc
commit
92993ea631
1 changed files with 6 additions and 1 deletions
|
@ -47,11 +47,15 @@ def zip_supports_bzip2(zip_tool)
|
|||
end
|
||||
|
||||
force_elevation = false
|
||||
run_in_debugger = false
|
||||
|
||||
OptionParser.new do |parser|
|
||||
parser.on("-f","--force-elevated","Force the updater to elevate itself") do
|
||||
force_elevation = true
|
||||
end
|
||||
parser.on("-d","--debug","Run the updater under GDB") do
|
||||
run_in_debugger = true
|
||||
end
|
||||
end.parse!
|
||||
|
||||
BZIP2_AVAILABLE = zip_supports_bzip2(ZIP_TOOL)
|
||||
|
@ -102,7 +106,8 @@ FileUtils.cp("../#{UPDATER_NAME}","#{PACKAGE_DIR}/#{UPDATER_NAME}")
|
|||
install_path = File.expand_path(INSTALL_DIR)
|
||||
Dir.chdir(INSTALL_DIR) do
|
||||
flags = "--force-elevated" if force_elevation
|
||||
cmd = "#{PACKAGE_DIR}/#{UPDATER_NAME} #{flags} --install-dir \"#{install_path}\" --package-dir \"#{PACKAGE_DIR}\" --script file_list.xml"
|
||||
debug_flags = "gdb --args" if run_in_debugger
|
||||
cmd = "#{debug_flags} #{PACKAGE_DIR}/#{UPDATER_NAME} #{flags} --install-dir \"#{install_path}\" --package-dir \"#{PACKAGE_DIR}\" --script file_list.xml"
|
||||
puts "Running '#{cmd}'"
|
||||
system(cmd)
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue