<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic RE: Unreliably reading std out with Utility - Environment action in Product Forum</title>
    <link>https://community.blueprism.com/t5/Product-Forum/Unreliably-reading-std-out-with-Utility-Environment-action/m-p/74739#M27344</link>
    <description>Hi Jamie,&lt;BR /&gt;&lt;BR /&gt;Have you tried by tweaking the condition a bit like this: &lt;CODE&gt;&lt;SPAN&gt;If Not String.IsNullOrEmpty(standardOutput.Result) Then Standard_Output = standardOutput.Result&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;BR /&gt;&lt;BR /&gt;------------------------------&lt;BR /&gt;----------------------------------&lt;BR /&gt;Hope it helps you out and if my solution resolves your query, then please mark it as the 'Best Answer' so that the others members in the community having similar problem statement can track the answer easily in future&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Devneet Mohanty&lt;BR /&gt;Intelligent Process Automation Consultant | Sr. Consultant - Automation Developer,&lt;BR /&gt;Wonderbotz India Pvt. Ltd.&lt;BR /&gt;Blue Prism Community MVP | Blue Prism 7x Certified Professional&lt;BR /&gt;Website: &lt;A href="https://devneet.github.io/" target="test_blank"&gt;https://devneet.github.io/&lt;/A&gt;&lt;BR /&gt;Email: devneetmohanty07@gmail.com&lt;BR /&gt;&lt;BR /&gt;----------------------------------&lt;BR /&gt;------------------------------&lt;BR /&gt;</description>
    <pubDate>Mon, 18 Apr 2022 12:39:00 GMT</pubDate>
    <dc:creator>devneetmohanty07</dc:creator>
    <dc:date>2022-04-18T12:39:00Z</dc:date>
    <item>
      <title>Unreliably reading std out with Utility - Environment action</title>
      <link>https://community.blueprism.com/t5/Product-Forum/Unreliably-reading-std-out-with-Utility-Environment-action/m-p/74737#M27342</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;&lt;BR /&gt;I've created an action under Utility - Environment which runs a process, waits for it to finish, and reads its standard output. This custom action works fine most of the time, except that 20-30% of the time the stdout comes out empty. I know that the process itself always outputs to stdout, it just seems that sometimes BP is unable to read it properly. &lt;BR /&gt;&lt;BR /&gt;My custom action is a combination of 2 existing actions in Utility - Environment: "Start Process Read StdErr and StdOut" and "Run Process Until Ended". I had to create my own custom action because (1) "Start Process Read StdErr and StdOut" doesn't have a 'Working Folder' or a 'Timeout' parameter and (2) it is not clear to me if this action actually waits for the process to end (I may be wrong about this last point). On the other hand, obviously Run Process Until Ended explicitly appears to wait for the process to end, but it does not read stdout or stderr. Therefore, I was able to combine both actions into one, which (usually) does both things I need, that is, is waits for the process to end or a timeout AND also reads the stdout. This is the code for the action I created:&lt;BR /&gt;&lt;BR /&gt;&lt;CODE&gt;timedOut = False&lt;/CODE&gt;&lt;BR /&gt;&lt;CODE&gt;Dim startTime as Date = Date.Now&lt;/CODE&gt;&lt;BR /&gt;&lt;CODE&gt;Dim processName As String = appn&lt;/CODE&gt;&lt;BR /&gt;&lt;CODE&gt;Dim proc As New Process() With {&lt;/CODE&gt;&lt;BR /&gt;&lt;CODE&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; .StartInfo = New ProcessStartInfo() With {&lt;/CODE&gt;&lt;BR /&gt;&lt;CODE&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .FileName = processName,&lt;/CODE&gt;&lt;BR /&gt;&lt;CODE&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .Arguments = args,&lt;/CODE&gt;&lt;BR /&gt;&lt;CODE&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .WorkingDirectory = dir,&lt;/CODE&gt;&lt;BR /&gt;&lt;CODE&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .UseShellExecute = False,&lt;/CODE&gt;&lt;BR /&gt;&lt;CODE&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .CreateNoWindow = False,&lt;/CODE&gt;&lt;BR /&gt;&lt;CODE&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .RedirectStandardError = True,&lt;/CODE&gt;&lt;BR /&gt;&lt;CODE&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .RedirectStandardOutput = True&lt;/CODE&gt;&lt;BR /&gt;&lt;CODE&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/CODE&gt;&lt;BR /&gt;&lt;CODE&gt;}&lt;/CODE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;CODE&gt;Using proc &lt;/CODE&gt;&lt;BR /&gt;&lt;CODE&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; proc.Start()&lt;/CODE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;CODE&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim standardOutput = proc.StandardOutput.ReadToEndAsync()&lt;/CODE&gt;&lt;BR /&gt;&lt;CODE&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim standardError = proc.StandardError.ReadToEndAsync()&lt;/CODE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;CODE&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; timedOut = Not proc.WaitForExit(CInt(timeout.TotalMilliseconds))&lt;/CODE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;CODE&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; If standardOutput.isCompleted Then Standard_Output = standardOutput.Result&lt;/CODE&gt;&lt;BR /&gt;&lt;CODE&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; If standardError.isCompleted Then Standard_Error = standardError.Result&lt;/CODE&gt;&lt;BR /&gt;&lt;CODE&gt;End Using&lt;/CODE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;As mentioned, this action typically works except for when stdout comes out empty, as evidenced by the logs. The &lt;CODE&gt;timeout&lt;/CODE&gt; is set to a pretty long time and my action is not raising its built-in timeout exception, so that's probably not it. I'm tempted to think that BP is simply unreliably reading this action's output, but I don't know how to improve my code (the line &lt;CODE&gt;If standardOutput.isCompleted Then Standard_Output = standardOutput.Result&lt;/CODE&gt;is pretty clear). &lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;Some forum posts talk about &lt;A href="https://community.blueprism.com/communities/community-home/digestviewer/viewthread?GroupId=145&amp;amp;MessageKey=9983bd2b-9c1b-4ba5-82bd-daa61804f5b3&amp;amp;CommunityKey=3743dbaa-6766-4a4d-b7ed-9a98b6b1dd01&amp;amp;tab=digestviewer" target="_blank" rel="noopener"&gt;adding delays or retries, or checking your data items&lt;/A&gt;, but that doesn't seem to apply here. Others recommend having BP &lt;A href="https://community.blueprism.com/communities/community-home/digestviewer/viewthread?GroupId=145&amp;amp;MID=4007&amp;amp;CommunityKey=3743dbaa-6766-4a4d-b7ed-9a98b6b1dd01&amp;amp;tab=digestviewer#:~:text=Another%20option%20is%20that%20you%20could%20modify%20your%20python%20script%20to%20generate%20a%20txt%20file%20with%20the%20output%2C%20and%20then%20use%20Blue%20Prism%20to%20read%20that%20file." target="_blank" rel="noopener"&gt;just read the log.txt&lt;/A&gt; that my process creates (which would add some complexity) or &lt;A href="https://community.blueprism.com/communities/community-home/digestviewer/viewthread?GroupId=145&amp;amp;MID=4007&amp;amp;CommunityKey=3743dbaa-6766-4a4d-b7ed-9a98b6b1dd01&amp;amp;tab=digestviewer#:~:text=Try%20pasting%C2%A0this%20into%20a%20code%20stage" target="_blank" rel="noopener"&gt;provide alternative code&lt;/A&gt;, but I don't really think it should be necessary. I mean, the above code is pretty straight-forward no?&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Any ideas? Thanks&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;PS. For context, the process I'm running is a Python script, but I don't believe the specific type of process should matter too much for this question.&lt;/P&gt;&lt;BR /&gt;&lt;BR /&gt;------------------------------&lt;BR /&gt;Jaime Salazar&lt;BR /&gt;------------------------------&lt;BR /&gt;</description>
      <pubDate>Mon, 18 Apr 2022 11:28:00 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/Unreliably-reading-std-out-with-Utility-Environment-action/m-p/74737#M27342</guid>
      <dc:creator>JaimeSalazar</dc:creator>
      <dc:date>2022-04-18T11:28:00Z</dc:date>
    </item>
    <item>
      <title>RE: Unreliably reading std out with Utility - Environment action</title>
      <link>https://community.blueprism.com/t5/Product-Forum/Unreliably-reading-std-out-with-Utility-Environment-action/m-p/74738#M27343</link>
      <description>Hi &lt;a href="https://community.blueprism.com/t5/user/viewprofilepage/user-id/26809"&gt;@JaimeSalazar&lt;/a&gt;&lt;BR /&gt;&lt;BR /&gt;Can you try putting these two sentence after the Process Start (proc.Start())?&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;​&lt;/STRONG&gt;&lt;SPAN&gt;&lt;STRONG&gt;proc.WaitForInputIdle()&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;proc.WaitForExit(CInt(timeout.TotalMilliseconds))&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;Then you can use the StreamReader with the method ReadToEnd (against ReadToEndAsync, because the process should already be finished at this point)&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Hope this helps you!&lt;BR /&gt;&lt;BR /&gt;Hasta luego &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;------------------------------&lt;BR /&gt;Pablo Sarabia&lt;BR /&gt;Architect&lt;BR /&gt;Altamira Assets Management&lt;BR /&gt;Madrid&lt;BR /&gt;------------------------------&lt;BR /&gt;</description>
      <pubDate>Mon, 18 Apr 2022 12:27:00 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/Unreliably-reading-std-out-with-Utility-Environment-action/m-p/74738#M27343</guid>
      <dc:creator>PabloSarabia</dc:creator>
      <dc:date>2022-04-18T12:27:00Z</dc:date>
    </item>
    <item>
      <title>RE: Unreliably reading std out with Utility - Environment action</title>
      <link>https://community.blueprism.com/t5/Product-Forum/Unreliably-reading-std-out-with-Utility-Environment-action/m-p/74739#M27344</link>
      <description>Hi Jamie,&lt;BR /&gt;&lt;BR /&gt;Have you tried by tweaking the condition a bit like this: &lt;CODE&gt;&lt;SPAN&gt;If Not String.IsNullOrEmpty(standardOutput.Result) Then Standard_Output = standardOutput.Result&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;BR /&gt;&lt;BR /&gt;------------------------------&lt;BR /&gt;----------------------------------&lt;BR /&gt;Hope it helps you out and if my solution resolves your query, then please mark it as the 'Best Answer' so that the others members in the community having similar problem statement can track the answer easily in future&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Devneet Mohanty&lt;BR /&gt;Intelligent Process Automation Consultant | Sr. Consultant - Automation Developer,&lt;BR /&gt;Wonderbotz India Pvt. Ltd.&lt;BR /&gt;Blue Prism Community MVP | Blue Prism 7x Certified Professional&lt;BR /&gt;Website: &lt;A href="https://devneet.github.io/" target="test_blank"&gt;https://devneet.github.io/&lt;/A&gt;&lt;BR /&gt;Email: devneetmohanty07@gmail.com&lt;BR /&gt;&lt;BR /&gt;----------------------------------&lt;BR /&gt;------------------------------&lt;BR /&gt;</description>
      <pubDate>Mon, 18 Apr 2022 12:39:00 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/Unreliably-reading-std-out-with-Utility-Environment-action/m-p/74739#M27344</guid>
      <dc:creator>devneetmohanty07</dc:creator>
      <dc:date>2022-04-18T12:39:00Z</dc:date>
    </item>
    <item>
      <title>RE: Unreliably reading std out with Utility - Environment action</title>
      <link>https://community.blueprism.com/t5/Product-Forum/Unreliably-reading-std-out-with-Utility-Environment-action/m-p/74740#M27345</link>
      <description>&lt;P&gt;Gracias Pablo, I'm assuming this part should therefore look like this:&lt;/P&gt;
&lt;P&gt;&lt;CODE&gt;Using proc &lt;/CODE&gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &lt;CODE&gt;proc.Start()&lt;/CODE&gt;&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &lt;CODE&gt;​proc.WaitForInputIdle()&lt;/CODE&gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &lt;CODE&gt;timedOut = Not proc.WaitForExit(CInt(timeout.TotalMilliseconds))&lt;/CODE&gt;&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;CODE&gt;Standard_Output  = proc.StandardOutput.ReadToEnd()&lt;/CODE&gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;CODE&gt;Standard_Error = proc.StandardError.ReadToEnd()&lt;/CODE&gt;&lt;CODE&gt;&lt;/CODE&gt;&lt;BR /&gt;&lt;CODE&gt;End Using&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;I'll test it a bit and post my results back to this thread.&lt;/P&gt;
&lt;BR /&gt;EDIT: Since&lt;CODE&gt;ReadToEnd()&lt;/CODE&gt; returns a &lt;CODE class="vb lang-vb" dir="ltr" data-author-content="Public Overrides Function ReadToEndAsync () As Task(Of String)"&gt;&lt;SPAN&gt;&lt;SPAN class="hljs-built_in"&gt;String&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt; instead of &lt;CODE&gt;ReadToEndAsync()&lt;/CODE&gt;'s&amp;nbsp; &lt;CODE class="vb lang-vb" dir="ltr" data-author-content="Public Overrides Function ReadToEndAsync () As Task(Of String)"&gt;&lt;SPAN&gt;Task(&lt;SPAN class="hljs-keyword"&gt;Of&lt;/SPAN&gt; &lt;SPAN class="hljs-built_in"&gt;String&lt;/SPAN&gt;)&lt;/SPAN&gt;&lt;/CODE&gt; , the original &lt;CODE&gt;standardOutput.isCompleted&lt;/CODE&gt; is not applicable anymore (nor does it appear to be necessary anymore thanks to this restructuring of the code).&lt;BR /&gt;&lt;BR /&gt;------------------------------&lt;BR /&gt;Jaime Salazar&lt;BR /&gt;------------------------------&lt;BR /&gt;</description>
      <pubDate>Mon, 18 Apr 2022 13:14:00 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/Unreliably-reading-std-out-with-Utility-Environment-action/m-p/74740#M27345</guid>
      <dc:creator>JaimeSalazar</dc:creator>
      <dc:date>2022-04-18T13:14:00Z</dc:date>
    </item>
    <item>
      <title>RE: Unreliably reading std out with Utility - Environment action</title>
      <link>https://community.blueprism.com/t5/Product-Forum/Unreliably-reading-std-out-with-Utility-Environment-action/m-p/74741#M27346</link>
      <description>Thanks for the tip Devneet, I'm going to try Pablo's suggestions first but I will definitely keep in mind the use of &lt;CODE&gt;&lt;SPAN&gt;String.IsNullOrEmpty()&lt;/SPAN&gt;&lt;/CODE&gt;. Will post back with results.&lt;BR /&gt;&lt;BR /&gt;------------------------------&lt;BR /&gt;Jaime Salazar&lt;BR /&gt;------------------------------&lt;BR /&gt;</description>
      <pubDate>Mon, 18 Apr 2022 13:16:00 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/Unreliably-reading-std-out-with-Utility-Environment-action/m-p/74741#M27346</guid>
      <dc:creator>JaimeSalazar</dc:creator>
      <dc:date>2022-04-18T13:16:00Z</dc:date>
    </item>
    <item>
      <title>RE: Unreliably reading std out with Utility - Environment action</title>
      <link>https://community.blueprism.com/t5/Product-Forum/Unreliably-reading-std-out-with-Utility-Environment-action/m-p/74742#M27347</link>
      <description>&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt;"&gt;&lt;SPAN lang="es"&gt;Thanks for the tip &lt;a href="https://community.blueprism.com/t5/user/viewprofilepage/user-id/66"&gt;@PabloSarabia&lt;/a&gt;, although it turns out that &lt;/SPAN&gt;&lt;CODE&gt;&lt;SPAN lang="en-US"&gt;WaitForInputIdle()&lt;/SPAN&gt;&lt;/CODE&gt;&lt;SPAN lang="es"&gt; fails. According to BP, it is likely "because the process does not have a user interface". Sure enough, the &lt;/SPAN&gt;&lt;A href="https://docs.microsoft.com/en-us/dotnet/api/system.diagnostics.process.waitforinputidle?view=net-6.0#:~:text=an%20idle%20state.-,This%20overload%20applies%20only%20to%20processes%20with%20a%20user%20interface%20and%2C%20therefore%2C%20a%20message%20loop.,-WaitForInputIdle()" target="_blank" rel="noopener"&gt;&lt;SPAN lang="en-US"&gt;docs&lt;/SPAN&gt;&lt;/A&gt;&lt;SPAN lang="es"&gt; mention that "This overload applies only to processes with a user interface and, therefore, a message loop." Although my bots are all Selenium (Python) scripts, I suppose they are not considered to have a user interface.&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;Once I removed that line, the code was able to at least run. However, throughout the next few days I noticed my Python programs started freezing at various times. I can't say for sure, but I think I really do need to go back to &lt;CODE&gt;ReadToEndAsync()&lt;/CODE&gt; instead of &lt;CODE&gt;ReadToEnd()&lt;/CODE&gt;. I have in fact gone back to my original code and Python is back to running smoothly.&lt;BR /&gt;&lt;BR /&gt;However, the issue remains where BP sometimes reads an empty stdout. I will likely be trying &lt;a href="https://community.blueprism.com/t5/user/viewprofilepage/user-id/1843"&gt;@devneetmohanty07&lt;/a&gt;'s suggestion in the next few days.&lt;/P&gt;
​​&lt;BR /&gt;&lt;BR /&gt;------------------------------&lt;BR /&gt;Jaime Salazar&lt;BR /&gt;------------------------------&lt;BR /&gt;</description>
      <pubDate>Fri, 22 Apr 2022 07:49:00 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/Unreliably-reading-std-out-with-Utility-Environment-action/m-p/74742#M27347</guid>
      <dc:creator>JaimeSalazar</dc:creator>
      <dc:date>2022-04-22T07:49:00Z</dc:date>
    </item>
    <item>
      <title>RE: Unreliably reading std out with Utility - Environment action</title>
      <link>https://community.blueprism.com/t5/Product-Forum/Unreliably-reading-std-out-with-Utility-Environment-action/m-p/74743#M27348</link>
      <description>To summarize, it looks like what has ended up working is &lt;a href="https://community.blueprism.com/t5/user/viewprofilepage/user-id/1843"&gt;@devneetmohanty07&lt;/a&gt;'s ​​solution regarding &lt;CODE&gt;&lt;SPAN&gt;If Not String.IsNullOrEmpty(standardOutput.Result)&lt;/SPAN&gt;&lt;/CODE&gt;. In particular, I decided to try with a for loop, which may or may not be required, I just know that I haven't read an empty stdout since I implemented it. Here is the full code in the customized action I created in the Utility - Environment VBO:&lt;BR /&gt;&lt;BR /&gt;&lt;CODE&gt;timedOut = False&lt;/CODE&gt;&lt;BR /&gt;&lt;CODE&gt;Dim startTime as Date = Date.Now&lt;/CODE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;CODE&gt;Dim processName As String = appn&lt;/CODE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;CODE&gt;Dim proc As New Process() With {&lt;/CODE&gt;&lt;BR /&gt;&lt;CODE&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; .StartInfo = New ProcessStartInfo() With {&lt;/CODE&gt;&lt;BR /&gt;&lt;CODE&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .FileName = processName,&lt;/CODE&gt;&lt;BR /&gt;&lt;CODE&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .Arguments = args,&lt;/CODE&gt;&lt;BR /&gt;&lt;CODE&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .WorkingDirectory = dir,&lt;/CODE&gt;&lt;BR /&gt;&lt;CODE&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .UseShellExecute = False,&lt;/CODE&gt;&lt;BR /&gt;&lt;CODE&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .CreateNoWindow = False,&lt;/CODE&gt;&lt;BR /&gt;&lt;CODE&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .RedirectStandardError = True,&lt;/CODE&gt;&lt;BR /&gt;&lt;CODE&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .RedirectStandardOutput = True&lt;/CODE&gt;&lt;BR /&gt;&lt;CODE&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/CODE&gt;&lt;BR /&gt;&lt;CODE&gt;}&lt;/CODE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;CODE&gt;Using proc &lt;/CODE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;CODE&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; proc.Start()&lt;/CODE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;CODE&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim standardOutput = proc.StandardOutput.ReadToEndAsync()&lt;/CODE&gt;&lt;BR /&gt;&lt;CODE&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim standardError = proc.StandardError.ReadToEndAsync()&lt;/CODE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;CODE&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; timedOut = Not proc.WaitForExit(CInt(timeout.TotalMilliseconds))&lt;/CODE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;CODE&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; For attempt As Integer = 0 To 2 &lt;/CODE&gt;&lt;BR /&gt;&lt;CODE&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If standardOutput.isCompleted And Not String.IsNullOrEmpty(standardOutput.Result)Then &lt;/CODE&gt;&lt;BR /&gt;&lt;CODE&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Standard_Output = standardOutput.Result&lt;/CODE&gt;&lt;BR /&gt;&lt;CODE&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Exit For&lt;/CODE&gt;&lt;BR /&gt;&lt;CODE&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; End If&lt;/CODE&gt;&lt;BR /&gt;&lt;CODE&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Threading.Thread.Sleep(5000) '5 seconds&lt;/CODE&gt;&lt;BR /&gt;&lt;CODE&gt;Next&lt;/CODE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;CODE&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; For attempt As Integer = 0 To 2 &lt;/CODE&gt;&lt;BR /&gt;&lt;CODE&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If standardError.isCompleted And Not String.IsNullOrEmpty(standardError.Result)Then &lt;/CODE&gt;&lt;BR /&gt;&lt;CODE&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Standard_Output = standardOutput.Result&lt;/CODE&gt;&lt;BR /&gt;&lt;CODE&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Exit For&lt;/CODE&gt;&lt;BR /&gt;&lt;CODE&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; End If&lt;/CODE&gt;&lt;BR /&gt;&lt;CODE&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Threading.Thread.Sleep(5000) '5 seconds&lt;/CODE&gt;&lt;BR /&gt;&lt;CODE&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Next&lt;/CODE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;CODE&gt;End Using&lt;/CODE&gt;&lt;BR /&gt;&lt;BR /&gt;Thanks for the help!&lt;BR /&gt;&lt;BR /&gt;------------------------------&lt;BR /&gt;Jaime Salazar&lt;BR /&gt;------------------------------&lt;BR /&gt;</description>
      <pubDate>Mon, 06 Jun 2022 07:26:00 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/Unreliably-reading-std-out-with-Utility-Environment-action/m-p/74743#M27348</guid>
      <dc:creator>JaimeSalazar</dc:creator>
      <dc:date>2022-06-06T07:26:00Z</dc:date>
    </item>
    <item>
      <title>RE: Unreliably reading std out with Utility - Environment action</title>
      <link>https://community.blueprism.com/t5/Product-Forum/Unreliably-reading-std-out-with-Utility-Environment-action/m-p/74744#M27349</link>
      <description>Thanks a lot Jamie to share the results with us and glad to see the solution working for you as well.​&lt;BR /&gt;&lt;BR /&gt;------------------------------&lt;BR /&gt;----------------------------------&lt;BR /&gt;Hope it helps you out and if my solution resolves your query, then please mark it as the 'Best Answer' so that the others members in the community having similar problem statement can track the answer easily in future&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Devneet Mohanty&lt;BR /&gt;Intelligent Process Automation Consultant | Sr. Consultant - Automation Developer,&lt;BR /&gt;WonderBotz India Pvt. Ltd.&lt;BR /&gt;Blue Prism Community MVP | Blue Prism 7x Certified Professional&lt;BR /&gt;Website: &lt;A href="https://devneet.github.io/" target="test_blank"&gt;https://devneet.github.io/&lt;/A&gt;&lt;BR /&gt;Email: devneetmohanty07@gmail.com&lt;BR /&gt;&lt;BR /&gt;----------------------------------&lt;BR /&gt;------------------------------&lt;BR /&gt;</description>
      <pubDate>Mon, 06 Jun 2022 08:14:00 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/Unreliably-reading-std-out-with-Utility-Environment-action/m-p/74744#M27349</guid>
      <dc:creator>devneetmohanty07</dc:creator>
      <dc:date>2022-06-06T08:14:00Z</dc:date>
    </item>
  </channel>
</rss>

