How to set ENV
based on cmd output in install
#4887
-
Output of
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi Tom, you can use backticks to capture command output (you may be familiar with this in shell, but this is also a Ruby-ism): ENV["RUSTFLAGS"] = `pkg-config --libs vips`.chomp # sets RUSTFLAGS in the environment
system "cargo", "install", "--features", "libvips", "--locked", "--path", "." # will use RUSTFLAGS set above One similar example of this in existing formula is https://github.com/Homebrew/homebrew-core/blob/a1640c6c17a2f4bc14336d364f1989da8631e1c8/Formula/x/xsd.rb#L52. You can generally use some other techniques for capturing command output in Ruby, including |
Beta Was this translation helpful? Give feedback.
Hi Tom, you can use backticks to capture command output (you may be familiar with this in shell, but this is also a Ruby-ism):
One similar example of this in existing formula is https://github.com/Homebrew/homebrew-core/blob/a1640c6c17a2f4bc14336d364f1989da8631e1c8/Formula/x/xsd.rb#L52.
You can generally use some other techniques for capturing command output in Ruby, including
::capture2
,::capture2e
, and/or::capture3
inOpen3
.