diff options
| author | Stan Hu <stanhu@gmail.com> | 2016-09-14 04:56:13 +0000 |
|---|---|---|
| committer | Stan Hu <stanhu@gmail.com> | 2016-09-14 04:56:13 +0000 |
| commit | 2c9ab6a78f07f4d2d5ead4ac9f76eb59c729ae32 (patch) | |
| tree | 4a8308321e0eac39628e4c7de6fef615dbb037b8 /lib | |
| parent | 4f6ad25b0d306c7f84ce4ec795ecd3ca9280fef3 (diff) | |
| parent | c90174afcd586b7652e527f4506b07ab833c7a87 (diff) | |
| download | gitlab-ce-2c9ab6a78f07f4d2d5ead4ac9f76eb59c729ae32.tar.gz | |
Merge branch 'fix/gitlab-popen-thread-safety' into 'master'
Fix Gitlab::Popen.popen thread-safety issue
## What does this MR do?
It changes the instance variables of `Gitlab::Popen.popen` to a local ones.
## Are there points in the code the reviewer needs to double check?
N/A
## Why was this MR needed?
It fixes a bug!
## Screenshots (if relevant)
N/A
## Does this MR meet the acceptance criteria?
- [x] [CHANGELOG](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CHANGELOG) entry added
- [ ] ~~[Documentation created/updated](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/development/doc_styleguide.md)~~
- [ ] ~~API support added~~
- Tests
- [ ] ~~Added for this feature/bug~~
- [x] All builds are passing
- [x] Conform by the [merge request performance guides](http://docs.gitlab.com/ce/development/merge_request_performance_guidelines.html)
- [x] Conform by the [style guides](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CONTRIBUTING.md#style-guides)
- [x] Branch has no merge conflicts with `master` (if you do - rebase it please)
- [x] [Squashed related commits together](https://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits)
## What are the relevant issue numbers?
#21842
See merge request !6194
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/gitlab/popen.rb | 12 |
1 files changed, 6 insertions, 6 deletions
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 |
