Replace subprocess rm calls with Python stdlib (#56083)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/56083

Changelog: [Internal]

Removes direct calls to `rm` in the snapshot generator

Reviewed By: cipolleschi

Differential Revision: D96455685

fbshipit-source-id: e53dd3607b8cbb7566903c29af303377276b1ec5
This commit is contained in:
Dawid Małecki authored and meta-codesync[bot] committed 2026-03-18 09:29:02 -07:00
1 parent 78a7718d6c
commit 59660bc0e1
1 file changed
+6 -2
+6 -2
View File
@@ -13,6 +13,7 @@ Usage:
import argparse
import os
import shutil
import subprocess
import sys
import tempfile
@@ -114,7 +115,7 @@ def build_snapshot_for_view(
if os.path.exists(os.path.join(react_native_dir, "api")):
if verbose:
print("Deleting existing output directory")
subprocess.run(["rm", "-rf", os.path.join(react_native_dir, "api")])
shutil.rmtree(os.path.join(react_native_dir, "api"))
if verbose:
print(f"Generating API view: {api_view}")
@@ -163,7 +164,10 @@ def build_snapshot_for_view(
# Delete the Doxygen config file
if verbose:
print("Deleting Doxygen config file")
subprocess.run(["rm", DOXYGEN_CONFIG_FILE], cwd=react_native_dir)
os.remove(os.path.join(react_native_dir, DOXYGEN_CONFIG_FILE))
if verbose:
print("Building snapshot")
# build snapshot, convert to string, and save to file
snapshot = build_snapshot(os.path.join(react_native_dir, "api", "xml"))