473149f0b1
The code for inheriting stdio handles was not taking into account that some of the stdio handles might be the same causing them to be duplicated in the list of inherited handles. However passing duplicate handles in PROC_THREAD_ATTRIBUTE_HANDLE_LIST causes CreateProcess to return E_INVALIDARG. This CL fixes the code to avoid duplicate handles. We also fix printing of errors, which was broken when Process::Exec was used without Dart scope causing it to print (null) instead of actual error message. Fixes https://github.com/dart-lang/sdk/issues/61981 TEST=vm/dart/regress_61981 Fixed: 61981 Change-Id: I93a6b56476f5020de9ebf894614cee51586b6751 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/464382 Reviewed-by: Alexander Aprelev <aam@google.com> Commit-Queue: Slava Egorov <vegorov@google.com>