Job results (from Receive-Job) are grouped by output type, differently than "normal" (BackgroundJob) jobs
還沒有人認領這個 Issue。
評估
- 難度
- 4/5
- 預估耗時
- 3-5 天
- 新手友好度
- 35/100
- Issue 類型
- 缺陷
- 描述清晰度
- 描述清楚
- 活躍度
- 停滯
- 技術堆疊
- powershell
- 領域
- backend
研究方向
The issue shows the behavior with Start-ThreadJob and Receive-Job on PowerShell 7.4.5 and ThreadJob 2.1.0. Start by reproducing the example and comparing its output order with Start-Job. Trace how ThreadJob collects and exposes the different output streams; done means Receive-Job preserves the order of interleaved output types.
由索引模型根據 Issue 內容生成。
描述
Consider the following code which starts a ThreadJob:
$job = Start-ThreadJob -ScriptBlock {
for( $i = 0 ; $i -lt 100 ; $i++ )
{
Write-Output "output $i"
Write-Host "host output $i"
Write-Information "info output $i"
Write-Verbose "verbose output $i"
Write-Warning "warning output $i"
Start-Sleep -Seconds 5
}
}
If I receive results of the job, the output is grouped according to the type of output:
PS C:\Users\me> Receive-Job $job
output 0
output 1
output 2
WARNING: warning output 0
WARNING: warning output 1
WARNING: warning output 2
host output 0
host output 1
host output 2
PS C:\Users\me>
This is in contrast to “normal” jobs—if I switch the call out for Start-Job, the results come in a more expected order:
PS C:\Users\me> Receive-Job $job
output 0
host output 0
WARNING: warning output 0
output 1
host output 1
WARNING: warning output 1
output 2
host output 2
WARNING: warning output 2
PS C:\Users\me>
Expected behavior
I expect the output from Receive-Job of a ThreadJob to come in the same order as from a BackgroundJob.
This is because I expect to be able to use thread jobs as a "drop-in" replacement for background jobs (modulo restrictions imposed due to running in the same process, like of course you wouldn't be able to load different versions of .NET assemblies).
Actual behavior
The output from a ThreadJob is all grouped by output type (all Warnings grouped together, all host output grouped together, etc.).
Environment data
Name Value
---- -----
PSVersion 7.4.5
PSEdition Core
GitCommitId 7.4.5
OS Microsoft Windows 10.0.26290
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
PS C:\Users\me> gmo *thread*
ModuleType Version PreRelease Name ExportedCommands
---------- ------- ---------- ---- ----------------
Binary 2.1.0 Microsoft.PowerShell.ThreadJob Start-ThreadJob
Version
7.4.5 / 2.1.0
- 主要語言
- PowerShell
- 星號
- 37
- 分支
- 22
- PR 合併指標
- 30 天內沒有已合併 PR
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 沒有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
PowerShell/ThreadJob 的其他 Issue
-
難度 4/5 3-5 天 新手友好度 48/100
PowerShell/ThreadJob#59 · 1 個 reaction ·
-
enhancement
難度 3/5 1-2 天 新手友好度 56/100
PowerShell/ThreadJob#56 · 1 個 reaction ·
-
Set alias for ThreadJob command(s)可能已有人在做 @kilasuit 於 80 天前認領。 未關閉
難度 2/5 1-3 小時 新手友好度 20/100
PowerShell/ThreadJob#45 · 1 則留言 ·
-
難度 1/5 1-3 小時 新手友好度 48/100
PowerShell/ThreadJob#44 ·
-
難度 4/5 3-5 天 新手友好度 35/100
PowerShell/ThreadJob#43 ·
查看 PowerShell/ThreadJob 的全部 Issue
相似的 Issue
-
ready
難度 2/5 1-3 小時 新手友好度 63/100
wheresrhys/totf#1214 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 78/100
CodeChefVIT/ffcs#281 ·
維護者通常 2 天內回覆
-
難度 2/5 1-3 小時 新手友好度 82/100
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 75/100
維護者通常 1 天內回覆
-
maintenance
難度 2/5 1-3 小時 新手友好度 78/100
維護者通常 1 天內回覆