Skip to content
This repository has been archived by the owner on Feb 12, 2022. 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
Open

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

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

Comments

@brandon-rhodes
Copy link

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
Copy link
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
Copy link

+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.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants