Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add timeout option for exec #254

Merged
merged 4 commits into from
Aug 31, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions lib/simctl.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
KazuCocoa marked this conversation as resolved.
Show resolved Hide resolved
*/

/**
Expand All @@ -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.
Expand Down Expand Up @@ -175,6 +177,7 @@ class Simctl {
encoding,
logErrors = true,
architectures,
timeout,
} = opts ?? {};
// run a particular simctl command
args = [
Expand All @@ -196,7 +199,11 @@ class Simctl {
encoding,
};
if (!asynchronous) {
execOpts.timeout = this.execTimeout;
if (timeout) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

execOpts.timeout = timeout || this.execTimeout

?

execOpts.timeout = timeout;
} else {
execOpts.timeout = this.execTimeout;
}
}
const xcrun = await this.requireXcrun();
try {
Expand Down
Loading