heroku / legacy-cli

Heroku CLI
https://cli.heroku.com
MIT License
1.37k stars 380 forks source link

Heroku run commands fail when output is piped in #756

Open jnovinger opened 11 years ago

jnovinger commented 11 years ago

I have the need, occasionally, to pipe a value in to a Heroku run command. Like the following:

yes yes | heroku run python manage.py syncdb -a $APP_NAME

This results in the following stacktrace:

Running `python manage.py syncdb` attached to terminal... up, run.5485
 !    Heroku client internal error.
 !    Search for help at: https://help.heroku.com
 !    Or report a bug at: https://github.com/heroku/heroku/issues/new

    Error:       Broken pipe (Errno::EPIPE)
    Backtrace:   /usr/lib/ruby/1.9.1/openssl/buffering.rb:318:in `syswrite'
                 /usr/lib/ruby/1.9.1/openssl/buffering.rb:318:in `do_write'
                 /usr/lib/ruby/1.9.1/openssl/buffering.rb:336:in `write'
                 /usr/local/heroku/lib/heroku/client/rendezvous.rb:64:in `block in start'
                 /usr/local/heroku/lib/heroku/client/rendezvous.rb:52:in `loop'
                 /usr/local/heroku/lib/heroku/client/rendezvous.rb:52:in `start'
                 /usr/local/heroku/lib/heroku/command/run.rb:124:in `rendezvous_session'
                 /usr/local/heroku/lib/heroku/command/run.rb:111:in `run_attached'
                 /usr/local/heroku/lib/heroku/command/run.rb:22:in `index'
                 /usr/local/heroku/lib/heroku/command.rb:206:in `run'
                 /usr/local/heroku/lib/heroku/cli.rb:28:in `start'
                 /usr/local/heroku/bin/heroku:25:in `<main>'

    Command:     heroku run python manage.py syncdb -a dd-stage-v4master
    Plugins:     heroku-config
    Version:     heroku-toolbelt/2.36.1 (x86_64-linux) ruby/1.9.3

This appears to behave similarly with other Heroku run commands:

yes yes | heroku run uptime -a $APP_NAME

But does not seem to effect other Heroku toolbelt commands.

jnovinger commented 11 years ago

heroku run "yes yes | python manage.py syncdb" -a $APP_NAME does appear to be a workaround.

nizaroni commented 10 years ago

I've also encountered this issue when trying to pipe heroku config:get values into shell scripts.