HaxeFoundation / HaxeFoundation/haxe
Inconsistent behaviour `Sys.stdin().readBytes()`
Open
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
Assessment
This issue has not been assessed yet.