From fd4b187b0503518271c457d8d2180db14d9a09b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hanno=20J=2E=20G=C3=B6decke?= Date: Wed, 1 Apr 2026 12:51:04 +0200 Subject: [PATCH 1/2] fix: handle devicectl launch arguments --- .../src/__tests__/launch-options.test.ts | 1 + packages/platform-ios/src/xcrun/devicectl.ts | 24 +++++++++++++++---- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/packages/platform-ios/src/__tests__/launch-options.test.ts b/packages/platform-ios/src/__tests__/launch-options.test.ts index 955ab29..0800bdd 100644 --- a/packages/platform-ios/src/__tests__/launch-options.test.ts +++ b/packages/platform-ios/src/__tests__/launch-options.test.ts @@ -35,6 +35,7 @@ describe('Apple app launch options', () => { '--environment-variables', '{"FEATURE_X":"1"}', 'com.example.app', + '--', '--mode=test', '--retry=1', ]); diff --git a/packages/platform-ios/src/xcrun/devicectl.ts b/packages/platform-ios/src/xcrun/devicectl.ts index bc3ddff..2bbd0b0 100644 --- a/packages/platform-ios/src/xcrun/devicectl.ts +++ b/packages/platform-ios/src/xcrun/devicectl.ts @@ -10,15 +10,27 @@ export const devicectl = async ( args: string[] ): Promise => { const tempFile = join(tmpdir(), `devicectl-${randomUUID()}.json`); + const separatorIndex = args.indexOf('--'); + const argsWithJsonOutput = + separatorIndex === -1 + ? [...args, '--json-output', tempFile] + : [ + ...args.slice(0, separatorIndex), + '--json-output', + tempFile, + ...args.slice(separatorIndex), + ]; await spawn('xcrun', [ 'devicectl', command, - ...args, - '--json-output', - tempFile, + ...argsWithJsonOutput, ]); + if (!fs.existsSync(tempFile)) { + throw new Error(`devicectl did not produce JSON output at ${tempFile}`); + } + const output = fs.readFileSync(tempFile, 'utf8'); fs.unlinkSync(tempFile); @@ -106,7 +118,11 @@ export const getDeviceCtlLaunchArgs = ( args.push('--environment-variables', JSON.stringify(environment)); } - args.push(bundleId, ...(options?.arguments ?? [])); + args.push(bundleId); + + if (options?.arguments?.length) { + args.push('--', ...options.arguments); + } return args; }; From 3629e731f692096b46e0df2da5618c27f9183303 Mon Sep 17 00:00:00 2001 From: Szymon Chmal Date: Thu, 2 Apr 2026 10:59:22 +0200 Subject: [PATCH 2/2] chore: add version plan for devicectl launch args --- .nx/version-plans/fix-devicectl-launch-args.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .nx/version-plans/fix-devicectl-launch-args.md diff --git a/.nx/version-plans/fix-devicectl-launch-args.md b/.nx/version-plans/fix-devicectl-launch-args.md new file mode 100644 index 0000000..78985de --- /dev/null +++ b/.nx/version-plans/fix-devicectl-launch-args.md @@ -0,0 +1,5 @@ +--- +__default__: patch +--- + +Physical iOS app launches now pass Harness launch arguments to `xcrun devicectl` without breaking JSON output collection. This prevents app launch arguments from being misinterpreted as `devicectl` flags and keeps device launches working when custom arguments are provided.