1+ import { exec as tpExec , SubProcess } from 'teen_process' ;
12import which from 'which' ;
2- import { log , LOG_PREFIX } from './logger.js' ;
3+
34import { DEFAULT_EXEC_TIMEOUT , getXcrunBinary } from './helpers.js' ;
4- import { exec as tpExec , SubProcess } from 'teen_process ' ;
5+ import { log , LOG_PREFIX } from './logger.js ' ;
56import * as addmediaCommands from './subcommands/addmedia.js' ;
67import * as appinfoCommands from './subcommands/appinfo.js' ;
78import * as bootCommands from './subcommands/boot.js' ;
@@ -10,23 +11,23 @@ import * as createCommands from './subcommands/create.js';
1011import * as deleteCommands from './subcommands/delete.js' ;
1112import * as eraseCommands from './subcommands/erase.js' ;
1213import * as getappcontainerCommands from './subcommands/get_app_container.js' ;
14+ import * as envCommands from './subcommands/getenv.js' ;
1315import * as installCommands from './subcommands/install.js' ;
1416import * as ioCommands from './subcommands/io.js' ;
1517import * as keychainCommands from './subcommands/keychain.js' ;
1618import * as launchCommands from './subcommands/launch.js' ;
1719import * as listCommands from './subcommands/list.js' ;
20+ import * as locationCommands from './subcommands/location.js' ;
1821import * as openurlCommands from './subcommands/openurl.js' ;
1922import * as pbcopyCommands from './subcommands/pbcopy.js' ;
2023import * as pbpasteCommands from './subcommands/pbpaste.js' ;
2124import * as privacyCommands from './subcommands/privacy.js' ;
2225import * as pushCommands from './subcommands/push.js' ;
23- import * as envCommands from './subcommands/getenv.js' ;
2426import * as shutdownCommands from './subcommands/shutdown.js' ;
2527import * as spawnCommands from './subcommands/spawn.js' ;
2628import * as terminateCommands from './subcommands/terminate.js' ;
2729import * as uiCommands from './subcommands/ui.js' ;
2830import * as uninstallCommands from './subcommands/uninstall.js' ;
29- import * as locationCommands from './subcommands/location.js' ;
3031import type { XCRun , ExecOpts , SimctlOpts , ExecResult } from './types.js' ;
3132
3233const SIMCTL_ENV_PREFIX = 'SIMCTL_CHILD_' ;
@@ -113,8 +114,7 @@ export class Simctl {
113114 requireUdid ( commandName : string | null = null ) : string {
114115 if ( ! this . udid ) {
115116 throw new Error (
116- `udid is required to be set for ` +
117- ( commandName ? `the '${ commandName } ' command` : 'this simctl command' ) ,
117+ `udid is required to be set for ` + ( commandName ? `the '${ commandName } ' command` : 'this simctl command' ) ,
118118 ) ;
119119 }
120120 return this . udid ;
@@ -130,10 +130,7 @@ export class Simctl {
130130 try {
131131 this . xcrun . path = await which ( xcrunBinary ) ;
132132 } catch {
133- throw new Error (
134- `${ xcrunBinary } tool has not been found in PATH. ` +
135- `Are Xcode developers tools installed?` ,
136- ) ;
133+ throw new Error ( `${ xcrunBinary } tool has not been found in PATH. Are Xcode developers tools installed?` ) ;
137134 }
138135 }
139136 if ( ! this . xcrun . path ) {
@@ -163,12 +160,7 @@ export class Simctl {
163160 timeout,
164161 } = opts ?? ( { } as T ) ;
165162 // run a particular simctl command
166- const args = [
167- 'simctl' ,
168- ...( this . devicesSetPath ? [ '--set' , this . devicesSetPath ] : [ ] ) ,
169- subcommand ,
170- ...initialArgs ,
171- ] ;
163+ const args = [ 'simctl' , ...( this . devicesSetPath ? [ '--set' , this . devicesSetPath ] : [ ] ) , subcommand , ...initialArgs ] ;
172164 // Prefix all passed in environment variables with 'SIMCTL_CHILD_', simctl
173165 // will then pass these to the child (spawned) process.
174166 const envWithPrefixedKeys = Object . fromEntries (
@@ -190,17 +182,16 @@ export class Simctl {
190182 try {
191183 let execArgs : [ string , string [ ] , any ] ;
192184 if ( architectures ?. length ) {
193- const archArgs = ( Array . isArray ( architectures ) ? architectures : [ architectures ] ) . flatMap (
194- ( arch ) => [ '-arch' , arch ] ,
195- ) ;
185+ const archArgs = ( Array . isArray ( architectures ) ? architectures : [ architectures ] ) . flatMap ( ( arch ) => [
186+ '-arch' ,
187+ arch ,
188+ ] ) ;
196189 execArgs = [ 'arch' , [ ...archArgs , xcrun , ...args ] , execOpts ] ;
197190 } else {
198191 execArgs = [ xcrun , args , execOpts ] ;
199192 }
200193 // We know what we are doing here - the type system can't handle the dynamic nature
201- return (
202- asynchronous ? new SubProcess ( ...execArgs ) : await tpExec ( ...execArgs )
203- ) as ExecResult < T > ;
194+ return ( asynchronous ? new SubProcess ( ...execArgs ) : await tpExec ( ...execArgs ) ) as ExecResult < T > ;
204195 } catch ( e : any ) {
205196 if ( ! this . logErrors || ! logErrors ) {
206197 // if we don't want to see the errors, just throw and allow the calling
0 commit comments