summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAhmad Sherif <me@ahmadsherif.com>2016-09-04 01:36:07 +0200
committerAhmad Sherif <me@ahmadsherif.com>2016-09-13 21:39:46 +0200
commitc90174afcd586b7652e527f4506b07ab833c7a87 (patch)
tree114c26526ca984e632b456babca09f7a70d1d8eb
parent5fdd92df39030ba4297189a274b8055fbca4b580 (diff)
downloadgitlab-ce-fix/gitlab-popen-thread-safety.tar.gz
Fix Gitlab::Popen.popen thread-safety issuefix/gitlab-popen-thread-safety
Fixes #21842
-rw-r--r--CHANGELOG1
-rw-r--r--lib/gitlab/popen.rb12
2 files changed, 7 insertions, 6 deletions
diff --git a/CHANGELOG b/CHANGELOG
index dc763269268..88b182c08fa 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -131,6 +131,7 @@ v 8.12.0 (unreleased)
- Remove duplication between project builds and admin builds view !5680 (Katarzyna Kobierska Ula Budziszewska)
- Deleting source project with existing fork link will close all related merge requests !6177 (Katarzyna Kobierska Ula Budziszeska)
- Return 204 instead of 404 for /ci/api/v1/builds/register.json if no builds are scheduled for a runner !6225
+ - Fix Gitlab::Popen.popen thread-safety issue
v 8.11.6 (unreleased)
- Fix an error where we were unable to create a CommitStatus for running state
diff --git a/lib/gitlab/popen.rb b/lib/gitlab/popen.rb
index a0fd41161a5..cc74bb29087 100644
--- a/lib/gitlab/popen.rb
+++ b/lib/gitlab/popen.rb
@@ -18,18 +18,18 @@ module Gitlab
FileUtils.mkdir_p(path)
end
- @cmd_output = ""
- @cmd_status = 0
+ cmd_output = ""
+ cmd_status = 0
Open3.popen3(vars, *cmd, options) do |stdin, stdout, stderr, wait_thr|
yield(stdin) if block_given?
stdin.close
- @cmd_output << stdout.read
- @cmd_output << stderr.read
- @cmd_status = wait_thr.value.exitstatus
+ cmd_output << stdout.read
+ cmd_output << stderr.read
+ cmd_status = wait_thr.value.exitstatus
end
- [@cmd_output, @cmd_status]
+ [cmd_output, cmd_status]
end
end
end