HaxeFoundation / HaxeFoundation/haxe

Inconsistent behaviour `Sys.stdin().readBytes()`

Open
#6,282 2 comments 0 reactions 0 assignees View on GitHub
standard library
Dominant language
Haxe
Stars
6.9k
Forks
715
Avg merge
2d 2h
Merged PRs (30d)
11

Description

```haxe
class Main {
static function main() {
var buf = haxe.io.Bytes.alloc(5);
var read = Sys.stdin().readBytes(buf, 0, buf.length);
trace(haxe.Json.stringify(buf.sub(0, read).toString()));
}
}
```

How to reproduce:

- Compile to code above to various platforms
- Run the program
- Key in a single char (e.g. "a") and press enter

Expected output:
- Prints `"a\n"` on screen and quits

Problem:
- on neko and cpp `readBytes` blocks until >= 5 characters has been input to stdin
- interp/java/cs/cpp/php works fine though

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.