Skip to content

Commit 59660bc

Browse files
coadometa-codesync[bot]
authored andcommitted
Replace subprocess rm calls with Python stdlib (#56083)
Summary: Pull Request resolved: #56083 Changelog: [Internal] Removes direct calls to `rm` in the snapshot generator Reviewed By: cipolleschi Differential Revision: D96455685 fbshipit-source-id: e53dd3607b8cbb7566903c29af303377276b1ec5
1 parent 78a7718 commit 59660bc

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

scripts/cxx-api/parser/__main__.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
import argparse
1515
import os
16+
import shutil
1617
import subprocess
1718
import sys
1819
import tempfile
@@ -114,7 +115,7 @@ def build_snapshot_for_view(
114115
if os.path.exists(os.path.join(react_native_dir, "api")):
115116
if verbose:
116117
print("Deleting existing output directory")
117-
subprocess.run(["rm", "-rf", os.path.join(react_native_dir, "api")])
118+
shutil.rmtree(os.path.join(react_native_dir, "api"))
118119

119120
if verbose:
120121
print(f"Generating API view: {api_view}")
@@ -163,7 +164,10 @@ def build_snapshot_for_view(
163164
# Delete the Doxygen config file
164165
if verbose:
165166
print("Deleting Doxygen config file")
166-
subprocess.run(["rm", DOXYGEN_CONFIG_FILE], cwd=react_native_dir)
167+
os.remove(os.path.join(react_native_dir, DOXYGEN_CONFIG_FILE))
168+
169+
if verbose:
170+
print("Building snapshot")
167171

168172
# build snapshot, convert to string, and save to file
169173
snapshot = build_snapshot(os.path.join(react_native_dir, "api", "xml"))

0 commit comments

Comments
 (0)