Forums/Knowledge Bases/CloudFoundry.com Knowledge Base

VMC Error: 'The input stream is exhausted'

Senthil Vaiyapuri
posted this on August 04, 2011 12:16

Contributors : Alex Suraci, Raja Rao

Problem

On some Mac OSX releases the stock ruby installed causes vmc client tool to fail emitting following error.  This is due to a library (used by vmc) incompatibility with the packaged ruby that comes with OSX.

For example in Mac OSX Lion, the stock ruby is 1.8.7 with patchlevel 249

$ ruby --version
ruby 1.8.7 (2010-01-10 patchlevel 249) [universal-darwin11.0]

And the error shows up during vmc transaction as 

$ vmc push      
Would you like to deploy from the current directory? [Yn]: The input stream is exhausted.
/Library/Ruby/Gems/1.8/gems/highline-1.6.2/lib/highline.rb:608:in `get_line'
/Library/Ruby/Gems/1.8/gems/highline-1.6.2/lib/highline.rb:629:in `get_response'
/Library/Ruby/Gems/1.8/gems/highline-1.6.2/lib/highline.rb:216:in `ask'
/Library/Ruby/Gems/1.8/gems/vmc-0.3.12/lib/cli/commands/apps.rb:370:in `push'
/Library/Ruby/Gems/1.8/gems/vmc-0.3.12/lib/cli/runner.rb:428:in `send'
/Library/Ruby/Gems/1.8/gems/vmc-0.3.12/lib/cli/runner.rb:428:in `run'
/Library/Ruby/Gems/1.8/gems/vmc-0.3.12/lib/cli/runner.rb:14:in `run'
/Library/Ruby/Gems/1.8/gems/vmc-0.3.12/bin/vmc:5
/usr/bin/vmc:19:in `load'
/usr/bin/vmc:19

 

Solution

Solution to this problem is to install RVM (Ruby Version Manager) and install and use 1.8.7 (or 1.9.2).  Typically higher patchlevels will get installed.  But please note that even if you install the same patchlevel as the stock ruby the problem will be solved.  

A quick guide to installing RVM 

2.  Add the below lines to ~/.bash_profile file
# Ruby Version Manager
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"
3.  Open new terminal 
4.  Re-install ruby 1.9.2 using rvm and also re-install the vmc gem under rvm installed ruby
$ rvm install 1.9.2
$ rvm use 1.9.2
$ gem install vmc

 

Sample Use 

Here is a transcript using rvm installed ruby. 

$ rvm use 1.8.7-p249
Using /Users/Alex/.rvm/gems/ruby-1.8.7-p249
$ ruby --version
ruby 1.8.7 (2010-01-10 patchlevel 249) [i686-darwin11.0.0]
$ vmc push
Would you like to deploy from the current directory? [Yn]: 
Application Name: hello-sinatra
Application Deployed URL: 'hello-sinatra.cloudfoundry.com'? hello-sinatra-alexsuraci.cloudfoundry.com
Detected a Sinatra Application, is this correct? [Yn]: 
Memory Reservation [Default:128M] (64M, 128M, 256M, 512M or 1G) 
Creating Application: OK
Would you like to bind any services to 'hello-sinatra'? [yN]: 
Uploading Application:
  Checking for available resources: OK
  Packing application: OK
  Uploading (2K): OK   
Push Status: OK
Staging Application: OK                                                         
Starting Application: OK
 
Topic is closed for comments