From b2071786a26cd3a6210c5798831c309b72f5cf2a Mon Sep 17 00:00:00 2001 From: Matthew Zagaja Date: Fri, 21 Oct 2022 18:07:22 -0400 Subject: [PATCH 1/2] Resolve #726 Panic Nova Edit Feature MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When typing “edit” into the debugger, Panic Nova would not wait because it requires the -w flag, and the call to system was not respecting it. This commit uses the Shellwords.split method to separate it into another argument for system so Nova or other editors that require a flag work properly. --- lib/debug/thread_client.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/debug/thread_client.rb b/lib/debug/thread_client.rb index 5f2d1001a..858fc0da1 100644 --- a/lib/debug/thread_client.rb +++ b/lib/debug/thread_client.rb @@ -2,6 +2,7 @@ require 'objspace' require 'pp' +require 'shellwords' require_relative 'color' @@ -643,7 +644,7 @@ def show_by_editor path = nil if editor = (ENV['RUBY_DEBUG_EDITOR'] || ENV['EDITOR']) puts "command: #{editor}" puts " path: #{path}" - system(editor, path) + system(*Shellwords.split(editor), path) else puts "can not find editor setting: ENV['RUBY_DEBUG_EDITOR'] or ENV['EDITOR']" end From 3ca1955d62637f7a3a06439f653ddd1120648317 Mon Sep 17 00:00:00 2001 From: Matthew Zagaja Date: Mon, 24 Oct 2022 17:12:22 -0400 Subject: [PATCH 2/2] Move Require shellwords Move require shellwords to right before calling it because it is not otherwise used in this class. --- lib/debug/thread_client.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/debug/thread_client.rb b/lib/debug/thread_client.rb index 858fc0da1..79d53e474 100644 --- a/lib/debug/thread_client.rb +++ b/lib/debug/thread_client.rb @@ -2,7 +2,6 @@ require 'objspace' require 'pp' -require 'shellwords' require_relative 'color' @@ -644,6 +643,7 @@ def show_by_editor path = nil if editor = (ENV['RUBY_DEBUG_EDITOR'] || ENV['EDITOR']) puts "command: #{editor}" puts " path: #{path}" + require 'shellwords' system(*Shellwords.split(editor), path) else puts "can not find editor setting: ENV['RUBY_DEBUG_EDITOR'] or ENV['EDITOR']"