Skip to content

Commit 9fe530a

Browse files
Merge pull request #305 from dixyushi/update-doc-executeCommand
Update function execute command
2 parents b6be111 + a37bc4a commit 9fe530a

1 file changed

Lines changed: 44 additions & 13 deletions

File tree

documentation/Functions.md

Lines changed: 44 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -158,14 +158,36 @@ Note: No background scripts are running and Katacoda user don't have to manually
158158
***
159159

160160
### executeCommand <a name="executeCommand"></a>
161+
This function is used when you want to use a bash (or powershell/cmd on windows) command.
162+
161163
#### parameter
162-
1. The command that will be executed on Windows
163-
2. The command that will be executed on Linux
164-
3. Json-object with optional fields
165-
* (Optional) Directory where the command will be executed, if not in current directory (relative to workspace){"dir": string}
166-
* (Optional) Synchronous or asynchronous process. Use asynchronous when starting a server. Default is synchronous. {"asynchronous": boolean}
167-
* (Optional) Array of arguments {"args": string[]}
168-
4. Assert information needed if you start a server to check server availability. Only required when you start a asynchronous server.
164+
This function consists of four parameters.
165+
166+
1. First parameter:
167+
- **Required**
168+
- **Type**- String
169+
- **Description**-It contains the input which is a command. The command that will be executed on Windows.
170+
171+
2. Second parameter:
172+
- **Required**
173+
- **Type**- String
174+
- **Description**-It contains the input which is a command. The command that will be executed on Linux.
175+
176+
3. Third parameter:
177+
- **Required**
178+
- **Type**- JSON object
179+
- **Description**- JSON object with optional fields
180+
* **First attribute**: (Optional) Directory where the command will be executed, if not in current directory (relative to workspace)
181+
Example: {"dir": string}
182+
* **Second attribute**: (Optional) Synchronous or asynchronous process. Use asynchronous when starting a server. Default is synchronous.
183+
Example: {"asynchronous": boolean}
184+
* **Third attribute**: (Optional) Array of arguments
185+
Example: {"args": string[]}
186+
187+
4. Fourth parameter:
188+
- **Required**
189+
- **Type**- JSON object
190+
- **Description**-Assertion information needed if you start a server to check server availability. Only required when you start a asynchronous server. This parameter is only needed when the command is an asynchronous command.
169191

170192
#### Commands
171193
It is needed to pass a command for Windows and also for Linux-based systems because both systems will always be tested.
@@ -182,17 +204,25 @@ interval: The availability of the server is checked in the given interval
182204

183205
#### example
184206

185-
executeCommand("node", "node" ,{"args": ["-v"]})
207+
* executeCommand("node", "node" ,{"args": ["-v"]})
186208
Will create a command for executing node -v .
187209

188-
executeCommand("somePollingScript.ps1","bash somePollingScript.sh", {"dir": "data/setup","asynchronous": true, "args": ["--params 5"]})
189-
Will create a command to execute the script in the directory with the parameter --params 5 and in a new terminal.
210+
* executeCommand("somePollingScript.ps1","bash somePollingScript.sh", {"dir": "data/setup", "args": ["--params 5"]})
211+
Will create a command to execute the script in the directory with the parameter --params 5 and in the current command prompt. The command prompt will be blocked until you stop the script.
190212

191-
executeCommand("someServerScript.ps1","bash someServerScript.sh", {"asynchronous": true, "args":["-port 8080"] },{"port":8080 , "startupTime": 20, "path": "some/path/", "interval": 2})
213+
* executeCommand("someServerScript.ps1","bash someServerScript.sh", {"asynchronous": true, "args":["-port 8080"] },{"port":8080 , "startupTime": 20, "path": "some/path/", "interval": 2})
192214
Starting a server in a new terminal. You have to specify the port for testing, the other parameters are optional. The startupTime can specify how long the runner will wait for a response from the server process and with interval you can set the frequenzy for the server testing. The path is the subpath from your server that should be reached.
193215

194216
***
195217

218+
Note:
219+
220+
1. The command for execution will be generated by Katacoda runner, so user will have to execute this command manually.
221+
222+
2. This command uses '/bin/sh' on Unix and the shell specified in %COMSPEC% on Windows.(Mostly cmd.exe, if you want to execute it on powershell add powershell.exe at the start of the command)
223+
224+
***
225+
196226
### installCobiGen <a name="installGobiGen"></a>
197227
#### parameter
198228
* No parameters
@@ -456,11 +486,12 @@ In second parameter, you can add 3 attributes.
456486
- **Third attribute**: It is optional and it is the array of npm arguments.
457487

458488
Example: {"args": string[]}
489+
459490
#### example
460-
* npmInstall("jump-the-queue/angular", {"name": "@angular/cli", "global": true, "args": ["--save-dev"]})
491+
npmInstall("jump-the-queue/angular", {"name": "@angular/cli", "global": true, "args": ["--save-dev"]})
461492
will run 'npm install -g --save-dev @angular/cli' in the directory 'jump-the-queue/angular'.
462493

463-
* npmInstall("my-thai-star/angular")
494+
npmInstall("my-thai-star/angular")
464495
will run 'npm install' in the directory 'my-thai-star/angular'
465496

466497
Note:

0 commit comments

Comments
 (0)