atom-community / atom-community/atom-script

Interleaving of stderr and stdout is non-deterministic

Open
#822 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
730
Forks
264
PR merge metrics
No merged PRs in 30d

Description

Running a script which writes both `stderr` and `stdout` in a given order, like the following Python:

``` python
import sys
sys.stderr.write('STDERR')
sys.stdout.write('STDOUT')
```

Or the following C:

``` c
#include
int main(void) {
fputs("STDERR", stderr);
fputs("STDOUT", stdout);
return 0;
}
```

causes the order of the display of the two lines to be seemingly random. That is, sometimes when either of these are run with CTRL-SHIFT-B, the `script` output is either

```
STDERR
STDOUT
```

Or

```
STDOUT
STDERR
```

But there doesn't seem to be an inclination either way, after running over and over.

When I run either of these in a terminal, the order is always as it is in the source, as expected. I think this is wrong because lack of deterministic stream display order is a nuisance.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.