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:
Jacob Vosmaer
2015-01-22 15:53:16 +01:00
parent f937e05949
commit a63187f28b
+1 -1
View File
@@ -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.