From cc0d7d3f22f3c5cea4583c4ed0718006f113a485 Mon Sep 17 00:00:00 2001 From: Kazuaki Matsuo Date: Thu, 29 Aug 2024 08:39:47 -0700 Subject: [PATCH 1/3] feat: add timeout option for exec --- lib/simctl.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/simctl.js b/lib/simctl.js index 2bc80e9..3c93dba 100644 --- a/lib/simctl.js +++ b/lib/simctl.js @@ -63,6 +63,8 @@ const DEFAULT_OPTS = { * command input and outputs. * @property {string|string[]} [architectures] - One or more architecture names to be enforced while * executing xcrun. See https://github.com/appium/appium/issues/18966 for more details. + * @property {number} [timeout] - The maximum number of milliseconds + * to wait for single synchronous xcrun command over the execTimeout by SimctlOpts. */ /** @@ -72,7 +74,7 @@ const DEFAULT_OPTS = { * the instance to automatically detect the full path to `xcrun` tool and to throw * an exception if it cannot be detected. If the path is set upon instance creation * then it is going to be used by `exec` and no autodetection will happen. - * @property {number} [execTimeout=600000] - The maximum number of milliseconds + * @property {number} [execTimeout=600000] - The default maximum number of milliseconds * to wait for single synchronous xcrun command. * @property {boolean} [logErrors=true] - Whether to wire xcrun error messages * into debug log before throwing them. @@ -175,6 +177,7 @@ class Simctl { encoding, logErrors = true, architectures, + timeout, } = opts ?? {}; // run a particular simctl command args = [ @@ -196,7 +199,11 @@ class Simctl { encoding, }; if (!asynchronous) { - execOpts.timeout = this.execTimeout; + if (timeout) { + execOpts.timeout = timeout; + } else { + execOpts.timeout = this.execTimeout; + } } const xcrun = await this.requireXcrun(); try { From 3a0d48dcbad5fe1d3c9e4959cad6cd3d8624b40a Mon Sep 17 00:00:00 2001 From: Kazuaki Matsuo Date: Thu, 29 Aug 2024 16:45:58 -0700 Subject: [PATCH 2/3] Update simctl.js --- lib/simctl.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/simctl.js b/lib/simctl.js index 3c93dba..5a2460a 100644 --- a/lib/simctl.js +++ b/lib/simctl.js @@ -64,7 +64,8 @@ const DEFAULT_OPTS = { * @property {string|string[]} [architectures] - One or more architecture names to be enforced while * executing xcrun. See https://github.com/appium/appium/issues/18966 for more details. * @property {number} [timeout] - The maximum number of milliseconds - * to wait for single synchronous xcrun command over the execTimeout by SimctlOpts. + * to wait for single synchronous xcrun command. If not provided explicitly, then + * the value of execTimeout property is used by default. */ /** From 25d88d0a03f6ba66874c9692a1c531c319cbcfd2 Mon Sep 17 00:00:00 2001 From: Kazuaki Matsuo Date: Fri, 30 Aug 2024 18:54:01 -0700 Subject: [PATCH 3/3] Update simctl.js --- lib/simctl.js | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/lib/simctl.js b/lib/simctl.js index 5a2460a..5339885 100644 --- a/lib/simctl.js +++ b/lib/simctl.js @@ -200,11 +200,7 @@ class Simctl { encoding, }; if (!asynchronous) { - if (timeout) { - execOpts.timeout = timeout; - } else { - execOpts.timeout = this.execTimeout; - } + execOpts.timeout = timeout || this.execTimeout; } const xcrun = await this.requireXcrun(); try {