Output from WSL command pipeline is randomly truncated #1438

Open
opened 2026-01-30 22:27:08 +00:00 by claunia · 0 comments
Owner

Originally created by @petsuter on GitHub (May 31, 2019).

Environment

Windows build number: 10.0.17134.765

Steps to reproduce

  • Open cmd.exe and enter the following commands:
mkdir test && cd test
FOR /L %i IN (100,1,999) DO echo %i >> data.txt
FOR /L %i IN (1,1,100) DO copy data.txt data%i.txt
wsl cat * | wsl sort | wsl uniq

Repeat the last line multiple times to repeat the problem with randomly different behavior.

Expected behavior

After the last command the terminal should display all integers from 100 to 999.

Actual behavior

After the last command the terminal only displays all integers from 100 to some random integer smaller than 999 (e.g. 978). Sometimes the last integer is not shown completely (e.g. only "97" instead of "978").


The output is truncated? One of the programs in the pipeline is aborted early? It might be a timing issue? Repeating the last command often results in the same "random" number, but sometimes it gets stops later / earlier.

Using different counts (e.g. 100 to 400 instead of 100 to 999) the problem also occurs.

Using slightly different commands the problem does not occur, e.g. this works correctly:

wsl
cat * | sort | uniq
Originally created by @petsuter on GitHub (May 31, 2019). # Environment ```none Windows build number: 10.0.17134.765 ``` # Steps to reproduce * Open `cmd.exe` and enter the following commands: ``` mkdir test && cd test FOR /L %i IN (100,1,999) DO echo %i >> data.txt FOR /L %i IN (1,1,100) DO copy data.txt data%i.txt wsl cat * | wsl sort | wsl uniq ``` Repeat the last line multiple times to repeat the problem with randomly different behavior. # Expected behavior After the last command the terminal should display all integers from 100 to 999. # Actual behavior After the last command the terminal only displays all integers from 100 to some random integer smaller than 999 (e.g. 978). Sometimes the last integer is not shown completely (e.g. only "97" instead of "978"). ---- The output is truncated? One of the programs in the pipeline is aborted early? It might be a timing issue? Repeating the last command often results in the same "random" number, but sometimes it gets stops later / earlier. Using different counts (e.g. 100 to 400 instead of 100 to 999) the problem also occurs. Using slightly different commands the problem does not occur, e.g. this works correctly: ``` wsl cat * | sort | uniq ```
claunia added the Product-WSLArea-OutputIssue-BugResolution-External labels 2026-01-30 22:27:08 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#1438