Skip to content

Commit 73de48d

Browse files
Fatme HavaluovaFatme Havaluova
authored andcommitted
Add timeout option and increate the default timeout
1 parent 43883fa commit 73de48d

File tree

4 files changed

+29
-2
lines changed

4 files changed

+29
-2
lines changed

lib/iphone-simulator.js

Lines changed: 13 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/iphone-simulator.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ export class iPhoneSimulator implements IiPhoneSimulator {
2727
private static SIMULATOR_FRAMEWORK_RELATIVE_PATH_LEGACY = "Platforms/iPhoneSimulator.platform/Developer/Library/PrivateFrameworks/DVTiPhoneSimulatorRemoteClient.framework";
2828
private static SIMULATOR_FRAMEWORK_RELATIVE_PATH = "../SharedFrameworks/DVTiPhoneSimulatorRemoteClient.framework";
2929

30+
private static DEFAULT_TIMEOUT_IN_SECONDS = 90;
31+
3032
public run(appPath: string): IFuture<void> {
3133
if(!fs.existsSync(appPath)) {
3234
errors.fail("Path does not exist ", appPath);
@@ -133,7 +135,18 @@ export class iPhoneSimulator implements IiPhoneSimulator {
133135
config("setLocalizedClientName", $("ios-sim-portable"));
134136

135137
var sessionError: any = new Buffer("");
136-
var time = $.NSNumber("numberWithDouble", 30);
138+
var timeoutParam = iPhoneSimulator.DEFAULT_TIMEOUT_IN_SECONDS;
139+
if (options.timeout || options.timeout === 0) {
140+
var parsedValue = parseInt(options.timeout);
141+
if(!isNaN(parsedValue) && parsedValue > 0) {
142+
timeoutParam = parsedValue;
143+
}
144+
else {
145+
console.log(util.format("Specify the timeout in number of seconds to wait. It should be greater than 0. Default value %s seconds will be used.", iPhoneSimulator.DEFAULT_TIMEOUT_IN_SECONDS.toString()));
146+
}
147+
}
148+
149+
var time = $.NSNumber("numberWithDouble", timeoutParam);
137150
var timeout = time("doubleValue");
138151

139152
var session = this.getClassByName("DTiPhoneSimulatorSession")("alloc")("init")("autorelease");

lib/options.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/options.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ var knownOptions: any = {
1111
"stderr": String,
1212
"env": String,
1313
"args": String,
14+
"timeout": String,
1415
"help": Boolean
1516
};
1617

0 commit comments

Comments
 (0)