Skip to content

A shell command that exits at once hangs ProcessSample on Windows #5

Closed

Description

@sferik

On Windows (CRuby 4.0), ProcessSample.once never reported when the command it ran was the shell's exit 3. ProcessSample's test_main timed out waiting 30 seconds for the report: https://github.com/sferik/duel-ruby/actions/runs/43297408133/job/131459288979

The test runs the command with Process.spawn(env, "exit 3", unsetenv_others: true, ...), where env is only PATH. Ruby on Windows runs exit (a command of cmd.exe's) through cmd.exe. I switched the test back to Ruby's exit 3 on Windows, which reports at once, so the cause is still unknown.

Two guesses. cmd.exe may not start or end properly with no SystemRoot or COMSPEC in its environment. Or the handle Native::Windows::Spawned opens on a process that ends that quickly may never be signalled. Either way a benchmark command that goes through the shell on Windows could hang the same way, so it's worth finding out. The first step is to reproduce it with Process.spawn({"PATH" => ENV["PATH"]}, "exit 3", unsetenv_others: true) alone, with and without SystemRoot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions