New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove usage of Dir.chdir that only execute a subprocess #6930
Conversation
ecf6678
to
7f56780
Compare
Preferring instead to spawn the subprocess in the correct directory
7f56780
to
ad5abd6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice cleanup.
@@ -22,20 +22,23 @@ def gem(name, version = "1.0") | |||
|
|||
def test_execute | |||
@cmd.options[:args] = %w[foo] | |||
@cmd.options[:editor] = "#{ruby_with_rubygems_in_load_path} -eexit --" | |||
@cmd.options[:editor] = (ruby_with_rubygems_in_load_path + ["-e", "puts(ARGV,Dir.pwd)", "--"]).join(" ") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ShellWords.shelljoin
maybe? Not a big deal.
Can’t use shelljoin because it isn’t shellsplit, it’s white space split in the command under testOn Sep 1, 2023, at 12:31 PM, Martin Emde ***@***.***> wrote:
@martinemde approved this pull request.
Nice cleanup.
In test/rubygems/test_gem_commands_open_command.rb:
@@ -22,20 +22,23 @@ def gem(name, version = "1.0")
def test_execute
@cmd.options[:args] = %w[foo]
- @cmd.options[:editor] = "#{ruby_with_rubygems_in_load_path} -eexit --"
+ @cmd.options[:editor] = (ruby_with_rubygems_in_load_path + ["-e", "puts(ARGV,Dir.pwd)", "--"]).join(" ")
ShellWords.shelljoin maybe? Not a big deal.
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: ***@***.***>
|
I'm curious a little why |
yeah, rubocop is configured for hash rockets |
Remove usage of Dir.chdir that only execute a subprocess (cherry picked from commit 10b2b5a)
Remove usage of Dir.chdir that only execute a subprocess (cherry picked from commit 10b2b5a)
Remove usage of Dir.chdir that only execute a subprocess (cherry picked from commit 10b2b5a)
Remove usage of Dir.chdir that only execute a subprocess (cherry picked from commit 10b2b5a)
Preferring instead to spawn the subprocess in the correct directory
What was the end-user or developer problem that led to this PR?
I noticed some usages of un-mutexed
Dir.chdir
callsWhat is your fix for the problem, implemented in this PR?
Use
chdir:
when spawning subprocessesMake sure the following tasks are checked