Skip to content
This repository has been archived by the owner on Jul 1, 2021. It is now read-only.

Commit

Permalink
Fix system call parameter for STDOUT to use :out (#124)
Browse files Browse the repository at this point in the history
:out is the preferred way to redirect child process output.  The current
code is passing STDOUT which is actually passing the file descriptor,
and works most of the time, but it will not work if the parent process
has changed STDOUT to a file descriptor that the child cannot use.

```
[1] pry(main)> STDOUT = $stdout = StringIO.new
(pry):1: warning: already initialized constant STDOUT
=> #<StringIO:0x007fe119768610>
[2] pry(main)> system("echo 'hi'", STDOUT => "/dev/null")
ArgumentError: wrong exec option
from (pry):2:in `system'
(pry):2:in `<main>'
[3] pry(main)> system("echo 'hi'", :out => "/dev/null")
=> true
```
  • Loading branch information
Fryguy authored and jrgarcia committed Dec 7, 2017
1 parent b7e3d60 commit 0e52e8c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/rbvmomi/vim/OvfManager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ def deployOVF opts
# to the uploadCmd. It is not clear to me why, but that leads to
# trucation of the uploaded disk. Without this option curl can't tell
# the progress, but who cares
system("#{downloadCmd} | #{uploadCmd}", STDOUT => "/dev/null")
system("#{downloadCmd} | #{uploadCmd}", :out => "/dev/null")

keepAliveThread.kill
keepAliveThread.join
Expand Down

0 comments on commit 0e52e8c

Please sign in to comment.