Title: Job results (from Receive-Job) are grouped by output type, differently than "normal" (BackgroundJob) jobs · Issue #40 · PowerShell/ThreadJob · GitHub
Open Graph Title: Job results (from Receive-Job) are grouped by output type, differently than "normal" (BackgroundJob) jobs · Issue #40 · PowerShell/ThreadJob
X Title: Job results (from Receive-Job) are grouped by output type, differently than "normal" (BackgroundJob) jobs · Issue #40 · PowerShell/ThreadJob
Description: 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 "verbos...
Open Graph Description: 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-Informatio...
X Description: 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&qu...
Opengraph URL: https://github.com/PowerShell/ThreadJob/issues/40
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Job results (from Receive-Job) are grouped by output type, differently than \"normal\" (BackgroundJob) jobs","articleBody":"Consider the following code which starts a ThreadJob:\r\n\r\n```ps1\r\n$job = Start-ThreadJob -ScriptBlock {\r\n\r\n for( $i = 0 ; $i -lt 100 ; $i++ )\r\n {\r\n Write-Output \"output $i\"\r\n Write-Host \"host output $i\"\r\n Write-Information \"info output $i\"\r\n Write-Verbose \"verbose output $i\"\r\n Write-Warning \"warning output $i\"\r\n\r\n Start-Sleep -Seconds 5\r\n }\r\n}\r\n```\r\n\r\nIf I receive results of the job, the output is grouped according to the type of output:\r\n\r\n```console\r\nPS C:\\Users\\me> Receive-Job $job\r\noutput 0\r\noutput 1\r\noutput 2\r\nWARNING: warning output 0\r\nWARNING: warning output 1\r\nWARNING: warning output 2\r\nhost output 0\r\nhost output 1\r\nhost output 2\r\nPS C:\\Users\\me>\r\n```\r\n\r\nThis is in contrast to “normal” jobs—if I switch the call out for `Start-Job`, the results come in a more expected order:\r\n\r\n```console\r\nPS C:\\Users\\me> Receive-Job $job\r\noutput 0\r\nhost output 0\r\nWARNING: warning output 0\r\noutput 1\r\nhost output 1\r\nWARNING: warning output 1\r\noutput 2\r\nhost output 2\r\nWARNING: warning output 2\r\nPS C:\\Users\\me>\r\n```\r\n\r\n\r\n### Expected behavior\r\n\r\n\r\nI expect the output from `Receive-Job` of a ThreadJob to come in the same order as from a BackgroundJob.\r\n\r\nThis 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).\r\n\r\n\r\n### Actual behavior\r\n\r\nThe output from a ThreadJob is all grouped by output type (all Warnings grouped together, all host output grouped together, etc.).\r\n\r\n### Environment data\r\n\r\n```PowerShell\r\nName Value\r\n---- -----\r\nPSVersion 7.4.5\r\nPSEdition Core\r\nGitCommitId 7.4.5\r\nOS Microsoft Windows 10.0.26290\r\nPlatform Win32NT\r\nPSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}\r\nPSRemotingProtocolVersion 2.3\r\nSerializationVersion 1.1.0.1\r\nWSManStackVersion 3.0\r\n\r\nPS C:\\Users\\me> gmo *thread*\r\n\r\nModuleType Version PreRelease Name ExportedCommands\r\n---------- ------- ---------- ---- ----------------\r\nBinary 2.1.0 Microsoft.PowerShell.ThreadJob Start-ThreadJob\r\n```\r\n\r\n\r\n### Version\r\n\r\n7.4.5 / 2.1.0\r\n","author":{"url":"https://github.com/jazzdelightsme","@type":"Person","name":"jazzdelightsme"},"datePublished":"2024-09-19T18:39:42Z","url":"https://github.com/PowerShell/ThreadJob/issues/40"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:f60534cc-20d0-d273-44b9-e78de1f83ddd |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8A6C:93ED1:48669:603F1:6AFCD8BC |
| html-safe-nonce | 78b9520dd8d428902264ebf5bd137ff6680d5cf271de11535740f6b0b95b4b82 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4QTZDOjkzRUQxOjQ4NjY5OjYwM0YxOjZBRkNEOEJDIiwidmlzaXRvcl9pZCI6IjQ3NTE1MzYyNzE0MTM1MzI4NjAiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 09540d591a35653303ce12115da1d6adf7317d9d5d56a0bb754faad7e4f1c72c |
| hovercard-subject-tag | issue:2537106442 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/PowerShell/ThreadJob/40/issue_layout |
| twitter:image | https://opengraph.githubassets.com/277b34435e056e822ce742ad3ca033a45bef46b30753f48b4b48a5735e3d6e23/PowerShell/ThreadJob/issues/40 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/277b34435e056e822ce742ad3ca033a45bef46b30753f48b4b48a5735e3d6e23/PowerShell/ThreadJob/issues/40 |
| og:image:alt | 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-Informatio... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | jazzdelightsme |
| hostname | github.com |
| expected-hostname | github.com |
| None | b5b7bc7e41e0a604bbdb5035c7ed9620c2d28b9c8a18747182e2262a75abfd91 |
| turbo-cache-control | no-preview |
| go-import | github.com/PowerShell/ThreadJob git https://github.com/PowerShell/ThreadJob.git |
| octolytics-dimension-user_id | 11524380 |
| octolytics-dimension-user_login | PowerShell |
| octolytics-dimension-repository_id | 265675369 |
| octolytics-dimension-repository_nwo | PowerShell/ThreadJob |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 265675369 |
| octolytics-dimension-repository_network_root_nwo | PowerShell/ThreadJob |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | ff5022cc3aa767e6115451d9c322dd975506d40e |
| ui-target | canary-1 |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width