HaxeFoundation/hashlink

The Hashlink profiler causes an exception in Process.stdout.readLine

LostBranch5502 opened this issue · 0 comments

Running the Hashlink profiler results in an exception if the program being profiled calls sys.io.Process.stdout.readLine.

Versions

  • Haxe: 4.3.3
  • Hashlink 1.13.0
  • Operating System: Ubuntu Linux 20.04.6 LTS (64-bit)

Reproducing

The issue should appear with the following test program:

import sys.io.Process;

class Main
{
    static public function main():Void
    {
        //var result = new Process("echo", ["Text from the Process."]).exitCode(); // This line works also with the profiler
        var result = new Process("echo", ["Text from the Process."]).stdout.readLine(); // This line works only without the profiler
        trace('$result');
    }
}

The program works with or without the profiler if Process.stdout.readLine is not called. The program also works when calling Process.stdout.readLine, but only if the profiler is not used. If Process.stdout.readLine is called and the program is being run with the profiler (hl --profile 1000 test.hl), the following exception happens:

Uncaught exception: Eof
Called from haxe.io.Input.readLine(.../haxe-4.3.3-linux64/haxe_20231117191750_de28889/std/haxe/io/Input.hx:189)
Called from $Main.main(Main.hx:7)
Called from .init(?:1)