Skip to content

ReadAsync hangs for specific executable #843

@michael-wolfenden

Description

@michael-wolfenden

Version(s)

v13.0.0

To reproduce

I'm trying to extract a version number from the openapi-changes cli tool.

The specific executable is available at:
https://github.com/pb33f/openapi-changes/releases/download/v0.2.1/openapi-changes_0.2.1_windows_x86_64.tar.gz

Calling openapi-changes.exe from the console works successfully

> .\openapi-changes.exe

@@@@@@@   @@@@@@@   @@@@@@   @@@@@@   @@@@@@@@
@@@@@@@@  @@@@@@@@  @@@@@@@  @@@@@@@  @@@@@@@@
@@!  @@@  @@!  @@@      @@@      @@@  @@!
!@!  @!@  !@   @!@      @!@      @!@  !@!
@!@@!@!   @!@!@!@   @!@!!@   @!@!!@   @!!!:!
!!@!!!    !!!@!!!!  !!@!@!   !!@!@!   !!!!!:
!!:       !!:  !!!      !!:      !!:  !!:
:!:       :!:  !:!      :!:      :!:  :!:
 ::        :: ::::  :: ::::  :: ::::   ::
 :        :: : ::    : : :    : : :    :

https://pb33f.io/openapi-changes/
------------------------------------
openapi-changes version: 0.2.1 | compiled: Sat, 11 Apr 2026 14:40:48 UTC

Current commands

  > console
  > summary
  > report
  > markdown-report
  > html-report

For more help, use the --help flag with any command.

However, the following script hangs

#:package SimpleExec@13.0.0

using static SimpleExec.Command;

var (standardOutput1, _) = await ReadAsync(@"C:\temp\openapi-changes.exe");

Console.WriteLine(standardOutput1);

Expected behaviour

ReadAsync to not hang and return stdOut

Actual behaviour

ReadAsync hangs

Workarounds

N/A

Additional context

After some debugging, it looks like the process never fires the Exited event.

This script works however

using System.Diagnostics;

var psi = new ProcessStartInfo(@"C:\temp\openapi-changes.exe")
{
    RedirectStandardOutput = true,
    RedirectStandardError = true,
    UseShellExecute = false,
};

using var process = new Process { StartInfo = psi };
process.Start();

var stdoutTask = process.StandardOutput.ReadToEndAsync();

await process.WaitForExitAsync();

string stdout = await stdoutTask;

Console.WriteLine(stdout);
> dotnet .\dump-output.cs

@@@@@@@   @@@@@@@   @@@@@@   @@@@@@   @@@@@@@@
@@@@@@@@  @@@@@@@@  @@@@@@@  @@@@@@@  @@@@@@@@
@@!  @@@  @@!  @@@      @@@      @@@  @@!
!@!  @!@  !@   @!@      @!@      @!@  !@!
@!@@!@!   @!@!@!@   @!@!!@   @!@!!@   @!!!:!
!!@!!!    !!!@!!!!  !!@!@!   !!@!@!   !!!!!:
!!:       !!:  !!!      !!:      !!:  !!:
:!:       :!:  !:!      :!:      :!:  :!:
 ::        :: ::::  :: ::::  :: ::::   ::
 :        :: : ::    : : :    : : :    :

https://pb33f.io/openapi-changes/
------------------------------------
openapi-changes version: 0.2.1 | compiled: Sat, 11 Apr 2026 14:40:48 UTC

Current commands

  > console
  > summary
  > report
  > markdown-report
  > html-report

For more help, use the --help flag with any command.

I'm not sure if the issue is with this specific executable or the SimpleExec library itself

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions