Skip to content

Commit

Permalink
feat: add timeout option for exec (#254)
Browse files Browse the repository at this point in the history
* feat: add timeout option for exec

* Update simctl.js

* Update simctl.js
  • Loading branch information
KazuCocoa authored Aug 31, 2024
1 parent 6cfc5c3 commit 1c2e1d8
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/simctl.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ 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. If not provided explicitly, then
* the value of execTimeout property is used by default.
*/

/**
Expand All @@ -72,7 +75,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.
Expand Down Expand Up @@ -175,6 +178,7 @@ class Simctl {
encoding,
logErrors = true,
architectures,
timeout,
} = opts ?? {};
// run a particular simctl command
args = [
Expand All @@ -196,7 +200,7 @@ class Simctl {
encoding,
};
if (!asynchronous) {
execOpts.timeout = this.execTimeout;
execOpts.timeout = timeout || this.execTimeout;
}
const xcrun = await this.requireXcrun();
try {
Expand Down

0 comments on commit 1c2e1d8

Please sign in to comment.