Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (process.platform === 'win32') {
const TASK_KILL = 'C:\\Windows\\System32\\taskkill.exe';
// when killing a process in Windows its child processes are *not* killed but become root processes.
// Therefore we use TASKKILL.EXE
try {
cp.execSync(`${TASK_KILL} /F /T /PID ${processId}`);
}
catch (err) {
console.log('Error killing process tree: ' + err);
}
}
else {
// on linux and OS X we kill all direct and indirect child processes as well
try {
const cmd = path.join(__dirname, '../../../scripts/terminateProcess.sh');
cp.spawnSync(cmd, [processId.toString()]);
}
catch (err) {
console.log('Error killing process tree: ' + err);
}
}
}
exports.killTree = killTree;
const run = (cmd, cwd) => {
const args = cmd.split(/\s/).slice(1);
const spawnOptions = {cwd};
const result = spawnSync(cmd.split(/\s/)[0], args, spawnOptions);
if (result.status !== 0) {
const message = `
ORIGINAL CMD: ${cmd}
STDOUT: ${result.stdout && result.stdout.toString()}
STDERR: ${result.stderr && result.stderr.toString()}
STATUS: ${result.status}
ERROR: ${result.error}
`;
throw new Error(message);
}
return result;
};
if (!err1 || err1.code !== 'VISUALLY_INCORRECT') {
return detach()
}
captureAndSaveDiff(title, expectedPath, function (err3, res) {
if (err3) return detach(err3)
console.error('A diff of the images have been saved to:', res.diff)
console.error('The actual image have been saved to:', res.actual)
detach()
})
}
try {
spawnSync('open', ['-a', 'Finder', mountPath])
} catch (spawnErr) {
return done(spawnErr)
}
retry(function (cb) {
captureAndVerify(title, expectedPath, cb)
}, done)
})
}
function ZonesString() {
var zoneadm = spawnSync('zoneadm', ['list', '-cp']);
var zones = zoneadm.stdout.toString().split('\n');
zones.pop();
return zones;
}
function run(cmd, args)
{
console.log('>', cmd, args.join(' '));
var result = child_process.spawnSync(
cmd,
args,
{
cwd: process.cwd(),
env: process.env,
stdio: 'inherit'
}
);
if (result.error)
throw result.error;
return result;
}
.action(function(appname, swiftpath, appprojectpath) {
validateAppName(appname);
if (!appprojectpath) appprojectpath = "./" + appname;
if (["/", "."].indexOf(swiftpath.substring(0, 1)) == -1)
swiftpath = "./" + swiftpath;
if (swiftpath.substring(0, 1) != "/") swiftpath = cwd() + "/" + swiftpath;
if (!fs.existsSync(swiftpath + "/package.json")) {
console.log("There is no valid project at the path: " + swiftpath + "\n");
return;
}
const swiftjson = require(swiftpath + "/package.json");
const swiftprojectname = swiftjson.name;
spawnSync("react-native", ["init", appname, appprojectpath], opts);
chdir(appprojectpath);
spawnSync("yarn", ["add", "react-native-swift"], opts);
spawnSync("yarn", ["link", swiftprojectname], opts);
spawnSync("yarn", ["add", swiftpath], opts);
spawnSync(
"yarn",
[
"add",
"react-native-fix-pod-links",
"react-native-xcode",
"react-native-setdevteam",
"react-native-bundlebase",
"react-native-fix-ios-version",
"react-native-camera-ios-enable"
],
opts
);
spawnSync("react-native", ["addpodlinks"], opts);
function runDiffImageToSnapshot(options) {
options.receivedImageBuffer = options.receivedImageBuffer.toString('base64');
const serializedInput = JSON.stringify(options);
let result = {};
const writeDiffProcess = childProcess.spawnSync(
process.execPath, [`${__dirname}/diff-process.js`],
{ input: Buffer.from(serializedInput), stdio: ['pipe', 'inherit', 'inherit', 'pipe'] }
);
if (writeDiffProcess.status === 0) {
const output = writeDiffProcess.output[3].toString();
result = JSON.parse(output);
} else {
throw new Error('Error running image diff.');
}
return result;
}
function run_shell(cmd, dir, ...args){
return child.spawnSync(cmd, args, {
shell: true,
cwd: dir,
stdio:[0,1,2]
});
}
function buildDistribution() {
let result = spawn('node', ['./build.js']);
return !result.stderr.toString().trim();
}