BHoM / Python_Toolkit

GNU Lesser General Public License v3.0
3 stars 2 forks source link

When installing packages, process locks on WaitForExit() #137

Closed Tom-Kingstone closed 5 months ago

Tom-Kingstone commented 5 months ago

Description:

When running InstallPackageLocal and an error occurs in the process, it locks on p.WaitForExit(). This is because stdError is being redirected, and read after waiting for process exit. When an error occurs in the process (causing it to write to stdError), the process doesn't exit, as the redirected buffer gets full, and cannot be added to as it is only read after process exit.

How to replicate:

Not very easy to replicate, needs an error that is large enough to fill the buffer. This was found by using a bad pip install and trying to install a local package.

Expected behaviour:

To fix, stdError should be read to end before waiting for the process to exit. This should apply to every case where stdError or stdOutput is being redirected.

Test file(s):