Skip to content

Commit 7643954

Browse files
moar
1 parent 06a15ab commit 7643954

1 file changed

Lines changed: 12 additions & 18 deletions

File tree

scripts/tunnel-creation.mjs

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -288,31 +288,25 @@ function parseArg(args, flagName) {
288288
return undefined;
289289
};
290290

291-
/**
292-
*/
293291
async function main() {
294-
// Create an instance of TunnelCreator
295-
const tunnelCreator = new TunnelCreator();
296292
const args = process.argv.slice(2);
297-
298293
const specificUdid = parseArg(args, '--udid');
299-
300294
const packetStreamBasePort = parseArg(args, '--packet-stream-base-port');
301-
if (packetStreamBasePort !== undefined) {
302-
tunnelCreator.packetStreamBasePort = parseInt(packetStreamBasePort, 10);
303-
}
304-
305295
const tunnelRegistryPort = parseArg(args, '--tunnel-registry-port');
306-
if (tunnelRegistryPort !== undefined) {
307-
tunnelCreator.tunnelRegistryPort = parseInt(tunnelRegistryPort, 10);
308-
}
309-
310-
const moduleRoot = node.getModuleRootSync('appium-xcuitest-driver', import.meta.url);
311-
if (!moduleRoot) {
312-
throw new Error('Cannot resolve module root for appium-xcuitest-driver');
313-
}
314296

297+
const tunnelCreator = new TunnelCreator();
315298
try {
299+
if (packetStreamBasePort !== undefined) {
300+
tunnelCreator.packetStreamBasePort = parseInt(packetStreamBasePort, 10);
301+
}
302+
if (tunnelRegistryPort !== undefined) {
303+
tunnelCreator.tunnelRegistryPort = parseInt(tunnelRegistryPort, 10);
304+
}
305+
const moduleRoot = node.getModuleRootSync('appium-xcuitest-driver', import.meta.url);
306+
if (!moduleRoot) {
307+
throw new Error('Cannot resolve module root for appium-xcuitest-driver');
308+
}
309+
316310
const packageJson = await fs.readFile(path.join(moduleRoot, 'package.json'), 'utf8');
317311
const packageInfo = JSON.parse(packageJson);
318312
const box = strongbox(packageInfo.name);

0 commit comments

Comments
 (0)