File tree Expand file tree Collapse file tree 1 file changed +19
-2
lines changed
Expand file tree Collapse file tree 1 file changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -43,12 +43,13 @@ export async function create(
4343 // const { stdout } = await execAsync(`xcrun simctl create "${name}" "${deviceType}" "${runtime}"`);
4444
4545 // const udid = stdout.trim();
46+ const udid = await getBootedSimulatorUUID ( ) ;
4647
47- console . log ( `✅ Simulator created (uuid: '${ /** udid */ "" } ')` ) ;
48+ console . log ( `✅ Simulator created (uuid: '${ udid } ')` ) ;
4849
4950 return {
5051 name,
51- udid : undefined ,
52+ udid,
5253 deviceType,
5354 } ;
5455}
@@ -64,6 +65,22 @@ export async function boot(simulator) {
6465 console . log ( "✅ Simulator booted." ) ;
6566}
6667
68+ /**
69+ * Gets the UUID of the currently booted simulator, if any.
70+ * @returns {Promise<string|null> } The UUID of the booted simulator, or null if none is booted.
71+ */
72+ export async function getBootedSimulatorUUID ( ) {
73+ try {
74+ const { stdout } = await execAsync (
75+ 'xcrun simctl list devices | grep "(Booted)" | grep -o "[A-F0-9-]\\{36\\}"' ,
76+ ) ;
77+ const uuid = stdout . trim ( ) ;
78+ return uuid || null ;
79+ } catch {
80+ return null ;
81+ }
82+ }
83+
6784/**
6885 * Installs an application on a simulator.
6986 * @param {Simulator } simulator The simulator object.
You can’t perform that action at this time.
0 commit comments