# A process stops printing data in a while loop when I use "Process" library to start this process in background

**URL:** <https://forum.robotframework.org/t/a-process-stops-printing-data-in-a-while-loop-when-i-use-process-library-to-start-this-process-in-background/7710>\
**Category:** Libraries\
**Created:** [19 August 2024 01:47 UTC](https://forum.robotframework.org/t/a-process-stops-printing-data-in-a-while-loop-when-i-use-process-library-to-start-this-process-in-background/7710 "2024-08-19T01:47:07Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![fon1105](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/fon1105/32/4149_2.png) [@fon1105](https://forum.robotframework.org/u/fon1105)\
**Post date:** [19 August 2024 01:47 UTC](https://forum.robotframework.org/t/a-process-stops-printing-data-in-a-while-loop-when-i-use-process-library-to-start-this-process-in-background/7710/1 "2024-08-19T01:47:07Z")

</div>

OS: Windows 11/Ubuntu 20.04.5 LTS  
Python: 3.12.0/3.8.10  
Robotframework: 7.0.1

I use “Process” library to start a process(print.py) in background. The process will keep writing data to a file in a while loop.  
**Start Process python print.py**

However, the process will suddenly stop print data to a file due to unknown reason while running test cases.

Could you help check and solve this issue? Thanks.

---

<div class="post-metadata">

**Author:** ![damies13](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/damies13/32/623_2.png) [@damies13](https://forum.robotframework.org/u/damies13)\
**Post date:** [19 August 2024 14:26 UTC](https://forum.robotframework.org/t/a-process-stops-printing-data-in-a-while-loop-when-i-use-process-library-to-start-this-process-in-background/7710/2 "2024-08-19T14:26:07Z")

</div>

Hi @fon1105 ,

Use [Is Process Running](https://robotframework.org/robotframework/latest/libraries/Process.html#Is%20Process%20Running) to confirm that it’s actually stopped, then use [Get Process Result](https://robotframework.org/robotframework/latest/libraries/Process.html#Get%20Process%20Result) if it’s not running or [Wait For Process](https://robotframework.org/robotframework/latest/libraries/Process.html#Wait%20For%20Process) if it is.

Once you have the result, you can check `${result.rc}`, `${result.stdout}`, and`${result.stderr}` to see what happened.

Dave.

---

<div class="post-metadata">

**Author:** ![fon1105](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/fon1105/32/4149_2.png) [@fon1105](https://forum.robotframework.org/u/fon1105)\
**Post date:** [20 August 2024 01:39 UTC](https://forum.robotframework.org/t/a-process-stops-printing-data-in-a-while-loop-when-i-use-process-library-to-start-this-process-in-background/7710/3 "2024-08-20T01:39:11Z")

</div>

Hello,  
Thank you for your reply.

The issue should be caused by the output buffers getting full because my script also writes something to the standard output.

If I redirect both stdout and stderr to file the issue will not happen.  
Is there any limitation about the output buffers with robotframework?

If I manually run the original print.py in another terminal instead of robotframework, the issue will not happen.

---

<div class="post-metadata">

**Author:** ![damies13](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/damies13/32/623_2.png) [@damies13](https://forum.robotframework.org/u/damies13)\
**Post date:** [20 August 2024 11:10 UTC](https://forum.robotframework.org/t/a-process-stops-printing-data-in-a-while-loop-when-i-use-process-library-to-start-this-process-in-background/7710/4 "2024-08-20T11:10:06Z")

</div>

Hi @fon1105,

I’m not sure what the buffer limits for stdout and stderr are if any, but if your script is putting a large amount of data to the console, redistricting to file is a good idea.

If you need to test the content of the output, you can read it in later with [Get File](https://robotframework.org/robotframework/latest/libraries/OperatingSystem.html#Get%20File) or similar.

I usually use a file for the consol output so I’ve never seen this issue

Dave.
