Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where does Start-Job output go?

Tags:

powershell

W:> $job = start-job { Write-Output "hi there"; throw "an error!" } | Wait-Job
W:> $job | select *


State         : Failed
HasMoreData   : True
StatusMessage :
Location      : localhost
Command       :  Write-Output "hi there"; throw "an error!"
JobStateInfo  : Failed
Finished      : System.Threading.ManualResetEvent
InstanceId    : 882957a9-a5e0-4876-bd22-0dbd87512f10
Id            : 7
Name          : Job7
ChildJobs     : {Job8}
PSBeginTime   : 3/24/2013 5:52:41 PM
PSEndTime     : 3/24/2013 5:52:47 PM
PSJobTypeName : BackgroundJob
Output        : {}
Error         : {}
Progress      : {}
Verbose       : {}
Debug         : {}
Warning       : {}

Where did my output go? How do I see the standard out/error streams?

like image 955
George Mauer Avatar asked Mar 24 '13 22:03

George Mauer


1 Answers

Jobs are running in the background, so they don't write to the console. You have to run Receive-Job after a job completes to collect its output.

like image 163
Ansgar Wiechers Avatar answered Nov 11 '22 15:11

Ansgar Wiechers