Skip to content

Commit 5c72e88

Browse files
committed
Make tnsArgs Array instead of string. This is required because we are using spawn instead of exec.
1 parent f923abe commit 5c72e88

File tree

4 files changed

+23
-12
lines changed

4 files changed

+23
-12
lines changed

package.json

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -184,9 +184,12 @@
184184
"default": []
185185
},
186186
"tnsArgs": {
187-
"type": "string",
187+
"type": "array",
188188
"description": "Optional arguments passed to the NativeScript CLI executable.",
189-
"default": null
189+
"items": {
190+
"type": "string"
191+
},
192+
"default": []
190193
},
191194
"appRoot": {
192195
"type": "string",
@@ -227,9 +230,12 @@
227230
"default": []
228231
},
229232
"tnsArgs": {
230-
"type": "string",
233+
"type": "array",
231234
"description": "Optional arguments passed to the NativeScript CLI executable.",
232-
"default": null
235+
"items": {
236+
"type": "string"
237+
},
238+
"default": []
233239
},
234240
"appRoot": {
235241
"type": "string",

src/nativescript/nativescript.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ export class IosProject extends NSProject {
9696
.appendParamIf("--start", args.request === "attach")
9797
.appendParamIf("--debug-brk", args.request === "launch")
9898
.appendParam("--no-client")
99-
.appendParam(args.tnsArgs)
99+
.appendParams(args.tnsArgs)
100100
.build();
101101

102102
let socketPathPrefix = 'socket-file-location: ';
@@ -176,7 +176,7 @@ export class AndroidProject extends NSProject {
176176
.appendParamIf("--emulator", args.emulator)
177177
.appendParam("--debug-brk")
178178
.appendParam("--no-client")
179-
.appendParam(args.tnsArgs)
179+
.appendParams(args.tnsArgs)
180180
.build();
181181

182182
Logger.log("tns debug command: " + command);
@@ -224,7 +224,7 @@ export class AndroidProject extends NSProject {
224224
.appendParam("debug")
225225
.appendParam(this.platform())
226226
.appendParam("--get-port")
227-
.appendParam(args.tnsArgs)
227+
.appendParams(args.tnsArgs)
228228
.build();
229229
let that = this;
230230
// run NativeScript CLI command
@@ -280,6 +280,11 @@ class CommandBuilder {
280280
return this;
281281
}
282282

283+
public appendParams(parameters: string[]): CommandBuilder {
284+
parameters.forEach(param => this.appendParam(param));
285+
return this;
286+
}
287+
283288
public appendParamIf(parameter: string, condtion: boolean): CommandBuilder {
284289
if (condtion) {
285290
this._command.push(parameter);

src/tests/scenario.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ export class Scenario {
5757
appRoot: appRoot,
5858
sourceMaps: true,
5959
emulator: emulator,
60-
tnsArgs: `${process.env.DeviceId ? `--device ${process.env.DeviceId}` : ''}`
60+
tnsArgs: process.env.DeviceId ? ['--device', process.env.DeviceId] : []
6161
};
6262
return args;
6363
}
@@ -69,8 +69,8 @@ export class Scenario {
6969
appRoot: appRoot,
7070
sourceMaps: true,
7171
emulator: emulator,
72-
tnsArgs: `${process.env.DeviceId ? `--device ${process.env.DeviceId}` : ''}`
73-
}
72+
tnsArgs: process.env.DeviceId ? ['--device', process.env.DeviceId] : []
73+
};
7474
return args;
7575
}
7676

src/webkit/webKitAdapterInterfaces.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export interface ILaunchRequestArgs extends DebugProtocol.LaunchRequestArguments
1010
diagnosticLogging?: boolean;
1111
emulator?:boolean;
1212
request: string;
13-
tnsArgs?: string;
13+
tnsArgs?: string[];
1414
}
1515

1616
export interface IAttachRequestArgs extends DebugProtocol.AttachRequestArguments {
@@ -20,7 +20,7 @@ export interface IAttachRequestArgs extends DebugProtocol.AttachRequestArguments
2020
diagnosticLogging?: boolean;
2121
emulator?:boolean;
2222
request: string;
23-
tnsArgs?: string;
23+
tnsArgs?: string[];
2424
}
2525

2626
export interface ISetBreakpointsArgs extends DebugProtocol.SetBreakpointsArguments {

0 commit comments

Comments
 (0)