[libcxx-commits] [PATCH] D107715: [libc++][NFC] Resolve Python 2 FIXME

Alexander Richardson via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Mon Aug 9 03:06:41 PDT 2021


arichardson requested changes to this revision.
arichardson added inline comments.
This revision now requires changes to proceed.


================
Comment at: libcxx/utils/libcxx/util.py:218
 
-        out,err = p.communicate(input=input)
+        out, err = p.communicate(input=input)
         exitCode = p.wait()
----------------
This code can be simplified with python 3: In our CHERI fork I changed this to use the `timeout=` parameter in https://github.com/CTSRD-CHERI/llvm-project/commit/824490b545707689e47cb6fc3a94633468c003a4. I was going to clean-up and upstream that once python3 is required but never got around to it.

However, I think we can avoid all of this complexity with `Popen`+`communicate` now that we require python 3.6:
We should be able to use `subprocess.run` (https://docs.python.org/3.6/library/subprocess.html#subprocess.run), translating the `TimeoutExpired` exception to `ExecuteCommandTimeoutException` (or just updating all callers).

`subprocess.run(command, cwd=cwd, input=input, stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=env)` should be sufficient I believe?




CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D107715/new/

https://reviews.llvm.org/D107715



More information about the libcxx-commits mailing list