This repository has been archived by the owner. It is now read-only.

"heroku run" sends "attached to terminal" message to stdout #585

Open
brandon-rhodes opened this Issue Sep 25, 2012 · 2 comments

Comments

Projects
None yet
3 participants
@brandon-rhodes

brandon-rhodes commented Sep 25, 2012

The "heroku run" command fouls the output of the command that it is running by putting its own status message on standard out, instead of on standard error where it belongs:

$ heroku run echo hi | wc
  2       9      55

Of course, "echo hi" should produce one line of output, not two—which would be the case if the following message were sent to standard error:

Running `echo hi` attached to terminal... up, run.1

This error makes it difficult to pass the output of "heroku run" into other Unix programs, like "grep" or "sort"—one has to write commands like:

$ heroku run find myapp/lib/ | (read throwaway; grep py)

Compare with the behavior of "ssh", which always sends status information to stderr:

$ ssh another_host echo hi | wc
...
... logging output ...
...
      1       1       3
@wuputah

This comment has been minimized.

Show comment
Hide comment
@wuputah

wuputah Dec 12, 2012

Contributor

I think there was some intent for this under #256; stdout should not be modified if the output channel is not a tty.

You can work around this by doing:

$ heroku run echo hi | tail -n +2
Contributor

wuputah commented Dec 12, 2012

I think there was some intent for this under #256; stdout should not be modified if the output channel is not a tty.

You can work around this by doing:

$ heroku run echo hi | tail -n +2
@duffytilleman

This comment has been minimized.

Show comment
Hide comment
@duffytilleman

duffytilleman Apr 3, 2015

+1 on this. #256 and #811 only addressed piping stdin. Heroku run is still writing to stdout, which is frustratingly bad practice. See for instance http://www.gnu.org/software/libc/manual/html_node/Standard-Streams.html or http://en.wikipedia.org/wiki/Standard_streams

duffytilleman commented Apr 3, 2015

+1 on this. #256 and #811 only addressed piping stdin. Heroku run is still writing to stdout, which is frustratingly bad practice. See for instance http://www.gnu.org/software/libc/manual/html_node/Standard-Streams.html or http://en.wikipedia.org/wiki/Standard_streams

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.