mirror of
https://github.com/wahyd4/gitlabhq.git
synced 2026-08-11 13:46:11 +10:00
Don't create zombies with IO.popen
The previous recommend incantation would leave the process we read from hanging around, even though it had finished. That gives you a 'defunct'/'zombie' process.
This commit is contained in:
@@ -108,7 +108,7 @@ In other repositories, such as gitlab-shell you can also use `IO.popen`.
|
||||
|
||||
```ruby
|
||||
# Safe IO.popen example
|
||||
logs = IO.popen(%W(git log), chdir: repo_dir).read
|
||||
logs = IO.popen(%W(git log), chdir: repo_dir) { |p| p.read }
|
||||
```
|
||||
|
||||
Note that unlike `Gitlab::Popen.popen`, `IO.popen` does not capture standard error.
|
||||
|
||||
Reference in New Issue
Block a user