Only set cwd on the newly spawned process, instead of the current one
This commit is contained in:
parent
4900390711
commit
81b5ce1152
1 changed files with 14 additions and 8 deletions
|
@ -82,15 +82,21 @@ module Gitlab
|
||||||
end
|
end
|
||||||
|
|
||||||
def call_update_hook(gl_id, gl_username, oldrev, newrev, ref)
|
def call_update_hook(gl_id, gl_username, oldrev, newrev, ref)
|
||||||
Dir.chdir(repo_path) do
|
|
||||||
env = {
|
env = {
|
||||||
'GL_ID' => gl_id,
|
'GL_ID' => gl_id,
|
||||||
'GL_USERNAME' => gl_username
|
'GL_USERNAME' => gl_username,
|
||||||
|
'PWD' => repo_path
|
||||||
}
|
}
|
||||||
stdout, stderr, status = Open3.capture3(env, path, ref, oldrev, newrev)
|
|
||||||
|
options = {
|
||||||
|
chdir: repo_path
|
||||||
|
}
|
||||||
|
|
||||||
|
args = [ref, oldrev, newrev]
|
||||||
|
|
||||||
|
stdout, stderr, status = Open3.capture3(env, path, *args, options)
|
||||||
[status.success?, (stderr.presence || stdout).gsub(/\R/, "<br>").html_safe]
|
[status.success?, (stderr.presence || stdout).gsub(/\R/, "<br>").html_safe]
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
def retrieve_error_message(stderr, stdout)
|
def retrieve_error_message(stderr, stdout)
|
||||||
err_message = stderr.read
|
err_message = stderr.read
|
||||||
|
|
Loading…
Reference in a new issue