@appium/coresim 1.3.0 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/lib/src/commands/process.d.ts.map +1 -1
- package/lib/src/commands/process.js +3 -4
- package/lib/src/commands/process.js.map +1 -1
- package/lib/src/commands/spawn.d.ts +9 -5
- package/lib/src/commands/spawn.d.ts.map +1 -1
- package/lib/src/commands/spawn.js +9 -5
- package/lib/src/commands/spawn.js.map +1 -1
- package/package.json +1 -1
- package/prebuilds/darwin-arm64/@appium+coresim.node +0 -0
- package/src/commands/process.ts +3 -4
- package/src/commands/spawn.ts +9 -5
- package/src/coresim.mm +31 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
## [1.4.0](https://github.com/appium/coresim/compare/v1.3.0...v1.4.0) (2026-09-19)
|
|
2
|
+
|
|
3
|
+
### Features
|
|
4
|
+
|
|
5
|
+
* resolve bare command names in spawnProcess against the runtime's bin dirs ([#16](https://github.com/appium/coresim/issues/16)) ([155654d](https://github.com/appium/coresim/commit/155654d1b2ac1235445cd511c0f7a0d49038bf26))
|
|
6
|
+
|
|
1
7
|
## [1.3.0](https://github.com/appium/coresim/compare/v1.2.1...v1.3.0) (2026-09-19)
|
|
2
8
|
|
|
3
9
|
### Features
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"process.d.ts","sourceRoot":"","sources":["../../../src/commands/process.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,qBAAqB,CAAC;AACtD,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,aAAa,CAAC;AAGhD,OAAO,QAAQ,qBAAqB,CAAC;IACnC,UAAU,YAAY;QACpB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC,CAAC;QACvD,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;KACnD;CACF;AAED;;;;;;;GAOG;AACH,wBAAsB,kBAAkB,CAAC,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAE1F;AAED;;;;;;GAMG;AACH,wBAAsB,aAAa,CAAC,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC,
|
|
1
|
+
{"version":3,"file":"process.d.ts","sourceRoot":"","sources":["../../../src/commands/process.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,qBAAqB,CAAC;AACtD,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,aAAa,CAAC;AAGhD,OAAO,QAAQ,qBAAqB,CAAC;IACnC,UAAU,YAAY;QACpB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC,CAAC;QACvD,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;KACnD;CACF;AAED;;;;;;;GAOG;AACH,wBAAsB,kBAAkB,CAAC,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAE1F;AAED;;;;;;GAMG;AACH,wBAAsB,aAAa,CAAC,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC,CA4C/F"}
|
|
@@ -20,10 +20,9 @@ export async function getRuntimeRootPath(udid) {
|
|
|
20
20
|
*/
|
|
21
21
|
export async function listProcesses(udid) {
|
|
22
22
|
return runCatchingAsync(async () => {
|
|
23
|
-
// spawnProcess() resolves
|
|
24
|
-
//
|
|
25
|
-
const
|
|
26
|
-
const proc = await this.spawnProcess(udid, launchctlPath, { arguments: [launchctlPath, 'list'] });
|
|
23
|
+
// Bare name: spawnProcess() resolves it against the guest runtime's own bin dirs, distinct
|
|
24
|
+
// from the host's /bin/launchctl (see CLAUDE.md).
|
|
25
|
+
const proc = await this.spawnProcess(udid, 'launchctl', { arguments: ['launchctl', 'list'] });
|
|
27
26
|
let stdout = '';
|
|
28
27
|
let stderr = '';
|
|
29
28
|
proc.stdout.on('data', (chunk) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"process.js","sourceRoot":"","sources":["../../../src/commands/process.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,EAAC,MAAM,aAAa,CAAC;AAIjC,OAAO,EAAC,gBAAgB,EAAC,MAAM,mBAAmB,CAAC;AASnD;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAqB,IAAY;IACvE,OAAO,gBAAgB,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,MAAM,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,eAAe,EAAE,CAAC,CAAC;AACxF,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CAAqB,IAAY;IAClE,OAAO,gBAAgB,CAAC,KAAK,IAAI,EAAE;QACjC,2FAA2F;QAC3F,
|
|
1
|
+
{"version":3,"file":"process.js","sourceRoot":"","sources":["../../../src/commands/process.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,EAAC,MAAM,aAAa,CAAC;AAIjC,OAAO,EAAC,gBAAgB,EAAC,MAAM,mBAAmB,CAAC;AASnD;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAqB,IAAY;IACvE,OAAO,gBAAgB,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,MAAM,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,eAAe,EAAE,CAAC,CAAC;AACxF,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CAAqB,IAAY;IAClE,OAAO,gBAAgB,CAAC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AAC,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;IAC7E,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACrC,IAAI,UAAU,IAAI,CAAC,EAAE,CAAC;QACpB,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC;IACnC,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -39,11 +39,15 @@ export declare class SpawnedProcess extends EventEmitter<SpawnedProcessEvents> {
|
|
|
39
39
|
* exit code/signal — see {@link SpawnedProcess}.
|
|
40
40
|
*
|
|
41
41
|
* @param udid — UDID of the target device
|
|
42
|
-
* @param path — path to the executable to spawn
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
42
|
+
* @param path — path to the executable to spawn. A bare name with no `/` (e.g. `launchctl`) is
|
|
43
|
+
* resolved by searching the Simulator runtime's standard bin dirs (`usr/bin`, `bin`, `usr/sbin`,
|
|
44
|
+
* `sbin`, `usr/local/bin`), mirroring `simctl spawn`'s own bare-name resolution — there's no way
|
|
45
|
+
* to query the guest's actual `$PATH`, so this is a fixed best-effort list, and throws if nothing
|
|
46
|
+
* matches. Anything containing `/` is instead resolved relative to the Simulator's own runtime
|
|
47
|
+
* root (e.g. `/usr/bin/log`) and confined there, so this cannot be used to spawn an arbitrary host
|
|
48
|
+
* executable. A leading `/` is tolerated (still resolved relative to the runtime root, not the
|
|
49
|
+
* host's own `/`). Throws if `path` would resolve outside the runtime (e.g. via `..`). Not
|
|
50
|
+
* auto-prepended to `options.arguments`.
|
|
47
51
|
* @param options — see {@link SpawnOptions}
|
|
48
52
|
* @returns a handle to the spawned process
|
|
49
53
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spawn.d.ts","sourceRoot":"","sources":["../../../src/commands/spawn.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,aAAa,CAAC;AACzC,OAAO,EAAC,MAAM,EAAC,MAAM,UAAU,CAAC;AAGhC,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,qBAAqB,CAAC;AACtD,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,aAAa,CAAC;AAG9C,OAAO,QAAQ,qBAAqB,CAAC;IACnC,UAAU,YAAY;QACpB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;KAC3F;CACF;AAYD,UAAU,oBAAoB;IAC5B,IAAI,EAAE,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,OAAO,GAAG,IAAI,CAAC,CAAC;CAC5D;AAED;;;;;;GAMG;AACH,qBAAa,cAAe,SAAQ,YAAY,CAAC,oBAAoB,CAAC;IAOlE,QAAQ,CAAC,GAAG,EAAE,MAAM;IANtB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAQ;IAC/B,UAAU,EAAE,MAAM,CAAC,OAAO,GAAG,IAAI,CAAQ;gBAG9B,GAAG,EAAE,MAAM,EACpB,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM;IAiBlB,kEAAkE;IAClE,IAAI,OAAO,IAAI,OAAO,CAErB;IAED;;;;;OAKG;IACH,IAAI,CAAC,MAAM,GAAE,MAAM,CAAC,OAAO,GAAG,MAAkB,GAAG,OAAO;CAa3D;AAED
|
|
1
|
+
{"version":3,"file":"spawn.d.ts","sourceRoot":"","sources":["../../../src/commands/spawn.ts"],"names":[],"mappings":"AAAA,OAAO,EAA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}
|
|
@@ -68,11 +68,15 @@ export class SpawnedProcess extends EventEmitter {
|
|
|
68
68
|
* exit code/signal — see {@link SpawnedProcess}.
|
|
69
69
|
*
|
|
70
70
|
* @param udid — UDID of the target device
|
|
71
|
-
* @param path — path to the executable to spawn
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
*
|
|
71
|
+
* @param path — path to the executable to spawn. A bare name with no `/` (e.g. `launchctl`) is
|
|
72
|
+
* resolved by searching the Simulator runtime's standard bin dirs (`usr/bin`, `bin`, `usr/sbin`,
|
|
73
|
+
* `sbin`, `usr/local/bin`), mirroring `simctl spawn`'s own bare-name resolution — there's no way
|
|
74
|
+
* to query the guest's actual `$PATH`, so this is a fixed best-effort list, and throws if nothing
|
|
75
|
+
* matches. Anything containing `/` is instead resolved relative to the Simulator's own runtime
|
|
76
|
+
* root (e.g. `/usr/bin/log`) and confined there, so this cannot be used to spawn an arbitrary host
|
|
77
|
+
* executable. A leading `/` is tolerated (still resolved relative to the runtime root, not the
|
|
78
|
+
* host's own `/`). Throws if `path` would resolve outside the runtime (e.g. via `..`). Not
|
|
79
|
+
* auto-prepended to `options.arguments`.
|
|
76
80
|
* @param options — see {@link SpawnOptions}
|
|
77
81
|
* @returns a handle to the spawned process
|
|
78
82
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spawn.js","sourceRoot":"","sources":["../../../src/commands/spawn.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,aAAa,CAAC;AACzC,OAAO,EAAC,MAAM,EAAC,MAAM,UAAU,CAAC;AAChC,OAAO,EAAC,SAAS,IAAI,WAAW,EAAC,MAAM,SAAS,CAAC;AAIjD,OAAO,EAAC,gBAAgB,EAAC,MAAM,mBAAmB,CAAC;AAQnD,8FAA8F;AAC9F,iGAAiG;AACjG,+FAA+F;AAC/F,iGAAiG;AACjG,6BAA6B;AAC7B,MAAM,qBAAqB,GAAmC,EAAE,CAAC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AAY,EACZ,UAAwB,EAAE;IAE1B,OAAO,gBAAgB,CAAC,KAAK,IAAI,EAAE;QACjC,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;QAC5C,oFAAoF;QACpF,4FAA4F;QAC5F,+FAA+F;QAC/F,gGAAgG;QAChG,+FAA+F;QAC/F,sCAAsC;QACtC,IAAI,IAAgC,CAAC;QACrC,IAAI,WAAqE,CAAC;QAC1E,MAAM,EAAC,GAAG,EAAE,QAAQ,EAAE,QAAQ,EAAC,GAAG,MAAM,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE;YACnF,IAAI,IAAI,EAAE,CAAC;gBACT,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;YACjC,CAAC;iBAAM,CAAC;gBACN,WAAW,GAAG,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;YAC/B,CAAC;QACH,CAAC,CAAC,CAAC;QACH,IAAI,GAAG,IAAI,cAAc,CAAC,GAAG,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC;QACnD,IAAI,WAAW,EAAE,CAAC;YAChB,0FAA0F;YAC1F,kGAAkG;YAClG,2FAA2F;YAC3F,2FAA2F;YAC3F,iFAAiF;YACjF,MAAM,QAAQ,GAAG,WAAW,CAAC;YAC7B,MAAM,SAAS,GAAG,IAAI,CAAC;YACvB,YAAY,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,WAAW,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC;QACzD,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC,CAAC,CAAC;AACL,CAAC"}
|
package/package.json
CHANGED
|
Binary file
|
package/src/commands/process.ts
CHANGED
|
@@ -32,10 +32,9 @@ export async function getRuntimeRootPath(this: NativeSimctl, udid: string): Prom
|
|
|
32
32
|
*/
|
|
33
33
|
export async function listProcesses(this: NativeSimctl, udid: string): Promise<SimProcessInfo[]> {
|
|
34
34
|
return runCatchingAsync(async () => {
|
|
35
|
-
// spawnProcess() resolves
|
|
36
|
-
//
|
|
37
|
-
const
|
|
38
|
-
const proc = await this.spawnProcess(udid, launchctlPath, {arguments: [launchctlPath, 'list']});
|
|
35
|
+
// Bare name: spawnProcess() resolves it against the guest runtime's own bin dirs, distinct
|
|
36
|
+
// from the host's /bin/launchctl (see CLAUDE.md).
|
|
37
|
+
const proc = await this.spawnProcess(udid, 'launchctl', {arguments: ['launchctl', 'list']});
|
|
39
38
|
let stdout = '';
|
|
40
39
|
let stderr = '';
|
|
41
40
|
proc.stdout.on('data', (chunk: Buffer) => {
|
package/src/commands/spawn.ts
CHANGED
|
@@ -90,11 +90,15 @@ export class SpawnedProcess extends EventEmitter<SpawnedProcessEvents> {
|
|
|
90
90
|
* exit code/signal — see {@link SpawnedProcess}.
|
|
91
91
|
*
|
|
92
92
|
* @param udid — UDID of the target device
|
|
93
|
-
* @param path — path to the executable to spawn
|
|
94
|
-
*
|
|
95
|
-
*
|
|
96
|
-
*
|
|
97
|
-
*
|
|
93
|
+
* @param path — path to the executable to spawn. A bare name with no `/` (e.g. `launchctl`) is
|
|
94
|
+
* resolved by searching the Simulator runtime's standard bin dirs (`usr/bin`, `bin`, `usr/sbin`,
|
|
95
|
+
* `sbin`, `usr/local/bin`), mirroring `simctl spawn`'s own bare-name resolution — there's no way
|
|
96
|
+
* to query the guest's actual `$PATH`, so this is a fixed best-effort list, and throws if nothing
|
|
97
|
+
* matches. Anything containing `/` is instead resolved relative to the Simulator's own runtime
|
|
98
|
+
* root (e.g. `/usr/bin/log`) and confined there, so this cannot be used to spawn an arbitrary host
|
|
99
|
+
* executable. A leading `/` is tolerated (still resolved relative to the runtime root, not the
|
|
100
|
+
* host's own `/`). Throws if `path` would resolve outside the runtime (e.g. via `..`). Not
|
|
101
|
+
* auto-prepended to `options.arguments`.
|
|
98
102
|
* @param options — see {@link SpawnOptions}
|
|
99
103
|
* @returns a handle to the spawned process
|
|
100
104
|
*/
|
package/src/coresim.mm
CHANGED
|
@@ -95,11 +95,36 @@ NSError* MakeSpawnPathError(NSString* message) {
|
|
|
95
95
|
return [NSError errorWithDomain:@"com.appium.coresim.spawn" code:1 userInfo:@{NSLocalizedDescriptionKey : message}];
|
|
96
96
|
}
|
|
97
97
|
|
|
98
|
+
// Standard bin dirs to search, in order, when `path` is a bare command name (no `/`) — mirrors
|
|
99
|
+
// the guest's default $PATH. There's no way to query the guest's actual $PATH (no shell, no env
|
|
100
|
+
// to read before a process even exists), so this is a fixed best-effort list, not a real PATH
|
|
101
|
+
// search — a binary installed somewhere else won't be found this way.
|
|
102
|
+
NSArray<NSString*>* BareCommandSearchDirs() { return @[ @"usr/bin", @"bin", @"usr/sbin", @"sbin", @"usr/local/bin" ]; }
|
|
103
|
+
|
|
104
|
+
// Resolves a bare command name (e.g. "launchctl") against BareCommandSearchDirs() under
|
|
105
|
+
// `runtimeRoot`, mirroring how `simctl spawn` resolves a bare name against the guest's $PATH —
|
|
106
|
+
// CoreSimulator's own spawn API takes only a literal path, so it does no such resolution itself.
|
|
107
|
+
NSString* ResolveBareCommand(NSString* runtimeRoot, NSString* name, NSError** error) {
|
|
108
|
+
NSFileManager* fm = [NSFileManager defaultManager];
|
|
109
|
+
for (NSString* dir in BareCommandSearchDirs()) {
|
|
110
|
+
NSString* candidate = [runtimeRoot stringByAppendingPathComponent:[dir stringByAppendingPathComponent:name]];
|
|
111
|
+
BOOL isDirectory = NO;
|
|
112
|
+
if ([fm fileExistsAtPath:candidate isDirectory:&isDirectory] && !isDirectory &&
|
|
113
|
+
[fm isExecutableFileAtPath:candidate]) {
|
|
114
|
+
return candidate;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
*error = MakeSpawnPathError(
|
|
118
|
+
[NSString stringWithFormat:@"'%@' not found in the Simulator runtime's standard bin directories", name]);
|
|
119
|
+
return nil;
|
|
120
|
+
}
|
|
121
|
+
|
|
98
122
|
// `spawnWithPath:options:...` can run anything the host user can execute, so Spawn() confines it
|
|
99
123
|
// to the Simulator's own runtime image rather than trusting `path` as a literal host path — a
|
|
100
|
-
// deliberately breaking restriction (see CLAUDE.md).
|
|
101
|
-
//
|
|
102
|
-
//
|
|
124
|
+
// deliberately breaking restriction (see CLAUDE.md). A bare name (no `/`) is resolved via
|
|
125
|
+
// ResolveBareCommand above instead; otherwise `path` is resolved as relative to the runtime root,
|
|
126
|
+
// then re-verified (via -stringByStandardizingPath, which collapses ".."/".") to still fall under
|
|
127
|
+
// it, since `path` may come from arbitrary caller input.
|
|
103
128
|
NSString* ResolveRuntimeBinaryPath(id device, NSString* path, NSError** error) {
|
|
104
129
|
id runtime = DeviceRuntime(device);
|
|
105
130
|
if (runtime == nil) {
|
|
@@ -107,6 +132,9 @@ NSString* ResolveRuntimeBinaryPath(id device, NSString* path, NSError** error) {
|
|
|
107
132
|
return nil;
|
|
108
133
|
}
|
|
109
134
|
NSString* runtimeRoot = coresim::RuntimeRootPath(runtime).stringByStandardizingPath;
|
|
135
|
+
if (![path containsString:@"/"]) {
|
|
136
|
+
return ResolveBareCommand(runtimeRoot, path, error);
|
|
137
|
+
}
|
|
110
138
|
NSString* resolved = [runtimeRoot stringByAppendingPathComponent:path].stringByStandardizingPath;
|
|
111
139
|
if (resolved != runtimeRoot && ![resolved hasPrefix:[runtimeRoot stringByAppendingString:@"/"]]) {
|
|
112
140
|
*error = MakeSpawnPathError(
|