Read output streams before calling WaitForExit() to avoid a deadlock for packages with many dependencies.

For packages with many dependencies the output stream from calling NuGet.exe in functions/Run-NuGet can be filled and cause a deadlock [as described on MSDN][1].

Moving the call to WaitForExit() to after the output streams have been read solves this problem.

[1]: http://msdn.microsoft.com/en-us/library/system.diagnostics.processstartinfo.redirectstandardoutput.aspx
Thanks for sharing your test code - I now know more powershell tricks than I ever really wanted to ;-)

It sounds like you two have this in hand, so I'll hold off on what I was doing.