From 7efc3ad80d4b78a708d9ba2a0442b41e4889b68c Mon Sep 17 00:00:00 2001 From: Tom Clegg Date: Fri, 15 Apr 2022 13:37:09 -0400 Subject: [PATCH] 18947: Avoid connecting git child to passenger/console stdin. Arvados-DCO-1.1-Signed-off-by: Tom Clegg --- apps/workbench/app/models/repository.rb | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/apps/workbench/app/models/repository.rb b/apps/workbench/app/models/repository.rb index 8b89d57ee9..fd30be9462 100644 --- a/apps/workbench/app/models/repository.rb +++ b/apps/workbench/app/models/repository.rb @@ -81,7 +81,7 @@ class Repository < ArvadosBase FileUtils.mkdir_p Rails.configuration.Workbench.RepositoryCache [['git', 'init', '--bare', workdir], ].each do |cmd| - system *cmd + system(*cmd, in: "/dev/null") raise GitCommandError.new($?.to_s) unless $?.exitstatus == 0 end end @@ -96,14 +96,15 @@ class Repository < ArvadosBase 'http.sslVerify', Rails.configuration.TLS.Insecure ? 'false' : 'true'], ].each do |cmd| - system *cmd + system(*cmd, in: "/dev/null") raise GitCommandError.new($?.to_s) unless $?.exitstatus == 0 end env = {}. merge(ENV). - merge('ARVADOS_API_TOKEN' => Thread.current[:arvados_api_token]) + merge('ARVADOS_API_TOKEN' => Thread.current[:arvados_api_token], + 'GIT_TERMINAL_PROMPT' => '0') cmd = ['git', '--git-dir', @workdir] + gitcmd - io = IO.popen(env, cmd, err: [:child, :out]) + io = IO.popen(env, cmd, err: [:child, :out], in: "/dev/null") output = io.read io.close # "If [io] is opened by IO.popen, close sets $?." --ruby 2.2.1 docs -- 2.30.2