Skip to content

binfmt.cpp: CreateNtProcessConfigureConsole: tcgetpgrp failed: Error is logged even though it is not an error #13173

@trallnag

Description

@trallnag

Windows Version

10.0.22621.5472

WSL Version

2.5.9.0

Are you using WSL 1 or WSL 2?

  • WSL 2
  • WSL 1

Kernel Version

6.6.87.2

Distro Version

Ubuntu 24.04

Other Software

Nothing of relevance.

Repro Steps

Within the distribution in a Bash or Zsh shell, execute the following:

sudo setsid --fork --wait "/mnt/c/Program Files/PowerShell/7/pwsh.exe" -NoLogo -NonInteractive -Command "Get-Date" 2>&1

Expected Behavior

Output just includes the date.

The relevant code is:

auto processGroup = tcgetpgrp(0);
if (processGroup < 0)
{
LOG_STDERR("tcgetpgrp failed");
return;
}
if (processGroup != getpgrp())
{
return;
}

I wonder why in the case of tcgetpgrp the error is logged but if getpgrp has a problem no error is logged. Maybe the log statement was once added for debugging purposes?

I came across this when setting up a scheduled monitoring task in WSL using Monit that triggers Powershell to send a notification to the desktop. It does so without a TTY.

Actual Behavior

Output includes error from binfmt and date.

tcgetpgrp failed: Not a tty
Montag, 23. Juni 2025 12:00:47

Diagnostic Logs

WslLogs-2025-06-23_12-10-43.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions