mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
fork: pass error_pipe path to yielded block
This commit is contained in:
parent
7c11699d73
commit
aac156ccdf
@ -37,15 +37,15 @@ module Utils
|
|||||||
pid = fork do
|
pid = fork do
|
||||||
# bootsnap doesn't like these forked processes
|
# bootsnap doesn't like these forked processes
|
||||||
ENV["HOMEBREW_NO_BOOTSNAP"] = "1"
|
ENV["HOMEBREW_NO_BOOTSNAP"] = "1"
|
||||||
|
error_pipe = server.path
|
||||||
ENV["HOMEBREW_ERROR_PIPE"] = server.path
|
ENV["HOMEBREW_ERROR_PIPE"] = error_pipe
|
||||||
server.close
|
server.close
|
||||||
read.close
|
read.close
|
||||||
write.fcntl(Fcntl::F_SETFD, Fcntl::FD_CLOEXEC)
|
write.fcntl(Fcntl::F_SETFD, Fcntl::FD_CLOEXEC)
|
||||||
|
|
||||||
Process::UID.change_privilege(Process.euid) if Process.euid != Process.uid
|
Process::UID.change_privilege(Process.euid) if Process.euid != Process.uid
|
||||||
|
|
||||||
yield
|
yield(error_pipe)
|
||||||
rescue Exception => e # rubocop:disable Lint/RescueException
|
rescue Exception => e # rubocop:disable Lint/RescueException
|
||||||
error_hash = JSON.parse e.to_json
|
error_hash = JSON.parse e.to_json
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user