mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
b5fd041917
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/44815 Remove our `test_ios_template` job for `test_ios_helloworld`. NOTE: There needs to be a followup to do the same in our Github Actions. Changelog: [General][Changed] use helloworld instead of template for CI tests. Reviewed By: cipolleschi Differential Revision: D57122797 fbshipit-source-id: 744c79230b716716fdfc234832f1eb241e091893
65 lines
1.5 KiB
JavaScript
65 lines
1.5 KiB
JavaScript
/**
|
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*
|
|
* @flow strict-local
|
|
* @format
|
|
* @oncall react_native
|
|
*/
|
|
|
|
import {execSync, spawn} from 'child_process';
|
|
import debug from 'debug';
|
|
import {existsSync} from 'fs';
|
|
import path from 'path';
|
|
|
|
const logWatchman = debug('helloworld:cli:watchman');
|
|
|
|
export async function pauseWatchman(command: () => Promise<mixed | void>) {
|
|
let p: ReturnType<typeof spawn> | null = null;
|
|
try {
|
|
const raw: string = execSync('watchman watch-project .', {
|
|
cwd: process.cwd(),
|
|
stdio: 'pipe',
|
|
}).toString();
|
|
const {watch} = JSON.parse(raw);
|
|
|
|
p = spawn('watchman', [
|
|
'--no-pretty',
|
|
'--persistent',
|
|
'state-enter',
|
|
watch,
|
|
'yarn-install',
|
|
]);
|
|
logWatchman(`[PID:${p.pid}] started`);
|
|
} catch (e) {
|
|
logWatchman(
|
|
`Unable to pause watchman: ${e.message}, running command anyway`,
|
|
);
|
|
} finally {
|
|
try {
|
|
// Always run our user, if watchman has problems or doesn't exist proceed.
|
|
await command();
|
|
} finally {
|
|
if (p?.killed || p?.exitCode != null) {
|
|
return;
|
|
}
|
|
logWatchman(`[PID:${p?.pid ?? '????'}] killing with SIGTERM`);
|
|
p?.kill('SIGTERM');
|
|
}
|
|
}
|
|
}
|
|
|
|
export function getExistingPath(
|
|
folder: string,
|
|
paths: $ReadOnlyArray<string>,
|
|
): string | null {
|
|
for (const p of paths) {
|
|
if (existsSync(path.join(folder, p))) {
|
|
return p;
|
|
}
|
|
}
|
|
return null;
|
|
}
|