alco / alco/porcelain

Porcelain.exec does not capture stderr output

Open
#47 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Elixir
Stars
958
Forks
45
PR merge metrics
No merged PRs in 30d

Description

`stderr` output produced by the process invoked via `Porcelain.exec` is not captured into result (printed by the program instead).

Repro info:

1. External program, prints to `stderr`:
```
15:20:55 markmark ~$ cat mine_err.sh
#!/usr/bin/env bash
echo "mine stderr" 1>&2
15:23:39 markmark ~$ ./mine_err.sh
mine stderr
```
(if attempting a repro, please make sure to `chmod +x mine_err.sh`)

2. Elixir code:
```elixir
r = Porcelain.exec("/Users/markmark/mine_err.sh", [])
IO.inspect r
```

3. Elixir output:
```
mine stderr
%Porcelain.Result{err: nil, out: "", status: 0}
```
^^^^ Note: `mine stderr` was printed by the program, but not included in Result.

-------
For comparison, when the external program outputs to `stdout`, things work as expected:

* external program, prints to `stdout`:
```
15:17:43 markmark ~$ cat mine.sh
#!/usr/bin/env bash
echo "mine stdout"
15:20:23 markmark ~$ ./mine.sh
mine stdout
```

* elixir code:
```elixir
r = Porcelain.exec("/Users/markmark/mine.sh", [])
IO.inspect r
```

* elixir output (stdout text captured in `out`, as expected):
```
%Porcelain.Result{err: nil, out: "mine stdout\n", status: 0}
```

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.