Skip to content
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

Merged
merged 1 commit into from Sep 21, 2023

Conversation

segiddins
Copy link
Member

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 calls

What is your fix for the problem, implemented in this PR?

Use chdir: when spawning subprocesses

Make sure the following tasks are checked

@segiddins segiddins changed the title Remove usage of Dir.chdir that just execute a subprocess Remove usage of Dir.chdir that only execute a subprocess Aug 31, 2023
Preferring instead to spawn the subprocess in the correct directory
Copy link
Member

@martinemde martinemde left a 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(" ")
Copy link
Member

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.

@segiddins
Copy link
Member Author

segiddins commented Sep 1, 2023 via email

@segiddins segiddins marked this pull request as ready for review September 12, 2023 19:34
@segiddins segiddins merged commit 10b2b5a into master Sep 21, 2023
104 of 105 checks passed
@segiddins segiddins deleted the segiddins/remove-chdir branch September 21, 2023 18:30
@nobu
Copy link
Contributor

nobu commented Sep 22, 2023

I'm curious a little why {:chdir => dir} is preferred over chdir: dir here.
Complained by Rubocop?

@segiddins
Copy link
Member Author

yeah, rubocop is configured for hash rockets

deivid-rodriguez pushed a commit that referenced this pull request Oct 13, 2023
Remove usage of Dir.chdir that only execute a subprocess

(cherry picked from commit 10b2b5a)
deivid-rodriguez pushed a commit that referenced this pull request Oct 13, 2023
Remove usage of Dir.chdir that only execute a subprocess

(cherry picked from commit 10b2b5a)
deivid-rodriguez pushed a commit that referenced this pull request Oct 13, 2023
Remove usage of Dir.chdir that only execute a subprocess

(cherry picked from commit 10b2b5a)
deivid-rodriguez pushed a commit that referenced this pull request Oct 16, 2023
Remove usage of Dir.chdir that only execute a subprocess

(cherry picked from commit 10b2b5a)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants