Skip to content

Commit 310be8d

Browse files
build: Avoid use of Dir.chdir
1 parent e5fa660 commit 310be8d

File tree

2 files changed

+17
-18
lines changed

2 files changed

+17
-18
lines changed

lib/ruby_wasm/build/product/baseruby.rb

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,11 @@ def build(executor)
2424
executor.mkdir_p product_build_dir
2525
@source.build(executor)
2626
return if Dir.exist?(install_dir)
27-
Dir.chdir(product_build_dir) do
28-
executor.system @source.configure_file,
29-
"--prefix=#{install_dir}",
30-
"--disable-install-doc"
31-
executor.system "make", "install"
32-
end
27+
executor.system @source.configure_file,
28+
"--prefix=#{install_dir}",
29+
"--disable-install-doc",
30+
chdir: product_build_dir
31+
executor.system "make", "install", chdir: product_build_dir
3332
end
3433
end
3534
end

lib/ruby_wasm/build/product/ruby_source.rb

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -72,18 +72,18 @@ def fetch(executor)
7272
def build(executor)
7373
fetch(executor) unless File.exist?(src_dir)
7474
unless File.exist?(configure_file)
75-
Dir.chdir(src_dir) do
76-
executor.system "ruby",
77-
"tool/downloader.rb",
78-
"-d",
79-
"tool",
80-
"-e",
81-
"gnu",
82-
"config.guess",
83-
"config.sub" or
84-
raise "failed to download config.guess and config.sub"
85-
executor.system "./autogen.sh" or raise "failed to run autogen.sh"
86-
end
75+
executor.system "ruby",
76+
"tool/downloader.rb",
77+
"-d",
78+
"tool",
79+
"-e",
80+
"gnu",
81+
"config.guess",
82+
"config.sub",
83+
chdir: src_dir or
84+
raise "failed to download config.guess and config.sub"
85+
executor.system "./autogen.sh", chdir: src_dir or
86+
raise "failed to run autogen.sh"
8787
end
8888
end
8989
end

0 commit comments

Comments
 (0)