Use fs.cpSync instead of execSync('cp ... (#43368)

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

This diff replaces direct invocation of the `cp` command with the platform agnostic `fs.cpSync`.
Changelog: [Internal]

Reviewed By: huntie

Differential Revision: D54634108

fbshipit-source-id: 41fe7b44b6534026ef1b930da85725bf3eb1e7bb
This commit is contained in:
Dmitry Rykun
2024-03-07 09:19:09 -08:00
committed by Facebook GitHub Bot
parent f7bbaffdc3
commit ff03b149e7
@@ -465,8 +465,7 @@ function generateCode(outputPath, schemaInfo, includesGeneratedCode, platform) {
const outputDir =
reactNativeCoreLibraryOutputPath(libraryName, platform) ?? outputPath;
fs.mkdirSync(outputDir, {recursive: true});
// TODO: Fix this. This will not work on Windows.
execSync(`cp -R ${tmpOutputDir}/* "${outputDir}"`);
fs.cpSync(tmpOutputDir, outputDir, {recursive: true});
console.log(`[Codegen] Generated artifacts: ${outputDir}`);
}