Skip to content

Commit 62b01dd

Browse files
committed
Support for --timeout 0
1 parent 2d21633 commit 62b01dd

File tree

3 files changed

+23
-2
lines changed

3 files changed

+23
-2
lines changed

lib/commands/debug.ts

+19-1
Original file line numberDiff line numberDiff line change
@@ -159,13 +159,31 @@ export class DebugIOSCommand implements ICommand {
159159
this.$errors.fail(`Applications for platform ${this.$devicePlatformsConstants.iOS} can not be built on this OS`);
160160
}
161161

162-
if (this.$options.timeout && !parseInt(this.$options.timeout, 10)) {
162+
const isValidTimeoutOption = this.isValidTimeoutOption();
163+
if (!isValidTimeoutOption) {
163164
this.$errors.fail(`Timeout option specifies the seconds NativeScript CLI will wait to find the inspector socket port from device's logs. Must be a number.`);
164165
}
165166

166167
return await this.debugPlatformCommand.canExecute(args) && await this.$platformService.validateOptions(this.$options.provision, this.$options.teamId, this.$projectData, this.$platformsData.availablePlatforms.iOS);
167168
}
168169

170+
private isValidTimeoutOption() {
171+
if (!this.$options.timeout) {
172+
return true;
173+
}
174+
175+
const timeout = parseInt(this.$options.timeout, 10);
176+
if (timeout === 0) {
177+
return true;
178+
}
179+
180+
if (!timeout) {
181+
return false;
182+
}
183+
184+
return true;
185+
}
186+
169187
public platform = this.$devicePlatformsConstants.iOS;
170188
}
171189

lib/common

lib/services/ios-debugger-port-service.ts

+3
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,9 @@ export class IOSDebuggerPortService implements IIOSDebuggerPortService {
109109

110110
private getTimeout(debugOptions: IDebugOptions): number {
111111
let timeout = parseInt(debugOptions && debugOptions.timeout, 10);
112+
if (timeout === 0) {
113+
timeout = Number.MAX_SAFE_INTEGER;
114+
}
112115
if (!timeout) {
113116
timeout = IOSDebuggerPortService.DEFAULT_TIMEOUT_IN_SECONDS;
114117
}

0 commit comments

Comments
 (0)