heroku / heroku/roadmap

Heroku CLI run command should separate stdout from stderr

Open
#304 1 comment 0 reactions 1 assignee Claimed by @dsouza-anush View on GitHub
Proposed Tooling
Dominant language
No language data
Stars
225
Forks
19
PR merge metrics
No merged PRs in 30d

Description

### Required Terms

- [X] I agree to follow this project's [Code of Conduct](https://github.com/heroku/roadmap/blob/main/CODE_OF_CONDUCT.md)
- [X] I have read and accept the [Salesforce Program Agreement](https://www.salesforce.com/company/program-agreement/)

### What service(s) is this request for?

CLI

### Tell us about what you're trying to solve. What challenges are you facing?

I assume this is a limitation of the rendezvous protocol, but when using the `heroku run` command, stdout and stderr streams are not separated, leading to mixed output. This behavior deviates from typical Unix command behavior where stdout and stderr are distinct. For example, if you were to run a Rake task that exports a CSV to stdout and prints a digest to stderr, the resulting file includes both outputs. This makes the CSV file invalid.

### Local example

```sh
rake export:csv > export.csv
# Output to stderr: 50d858e0985ecc7f60418aaf0cc5ab587f42c2570a884095a9e8ccacd0f6545c
cat export.csv
# Result: a valid CSV file
```

### Heroku example

```sh
heroku run rake export:csv > export.csv
# Output to stderr:
cat export.csv
# Result: a malformed CSV file
```

Typically, if you wanted to combine stdout and stderr, you'd explicitly use `2>&1`.

Refs: https://github.com/heroku/cli/issues/1835, https://github.com/heroku/legacy-cli/issues/1214

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.