Skip to content

Commit 1c2e1d8

Browse files
authoredAug 31, 2024··
feat: add timeout option for exec (#254)
* feat: add timeout option for exec * Update simctl.js * Update simctl.js
1 parent 6cfc5c3 commit 1c2e1d8

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed
 

‎lib/simctl.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,9 @@ const DEFAULT_OPTS = {
6363
* command input and outputs.
6464
* @property {string|string[]} [architectures] - One or more architecture names to be enforced while
6565
* executing xcrun. See https://github.com/appium/appium/issues/18966 for more details.
66+
* @property {number} [timeout] - The maximum number of milliseconds
67+
* to wait for single synchronous xcrun command. If not provided explicitly, then
68+
* the value of execTimeout property is used by default.
6669
*/
6770

6871
/**
@@ -72,7 +75,7 @@ const DEFAULT_OPTS = {
7275
* the instance to automatically detect the full path to `xcrun` tool and to throw
7376
* an exception if it cannot be detected. If the path is set upon instance creation
7477
* then it is going to be used by `exec` and no autodetection will happen.
75-
* @property {number} [execTimeout=600000] - The maximum number of milliseconds
78+
* @property {number} [execTimeout=600000] - The default maximum number of milliseconds
7679
* to wait for single synchronous xcrun command.
7780
* @property {boolean} [logErrors=true] - Whether to wire xcrun error messages
7881
* into debug log before throwing them.
@@ -175,6 +178,7 @@ class Simctl {
175178
encoding,
176179
logErrors = true,
177180
architectures,
181+
timeout,
178182
} = opts ?? {};
179183
// run a particular simctl command
180184
args = [
@@ -196,7 +200,7 @@ class Simctl {
196200
encoding,
197201
};
198202
if (!asynchronous) {
199-
execOpts.timeout = this.execTimeout;
203+
execOpts.timeout = timeout || this.execTimeout;
200204
}
201205
const xcrun = await this.requireXcrun();
202206
try {

0 commit comments

Comments
 (0)
Please sign in to comment.