... | ... | @@ -218,3 +218,33 @@ You can display the version of the server: |
|
|
```
|
|
|
$ cmo version
|
|
|
```
|
|
|
|
|
|
# Exit code
|
|
|
|
|
|
Sometimes we need to get the exit code of an app. It is possible to do it with the API as well as with the console. The APIs provide the *getExitCode()* function or method of the *Instance* class.
|
|
|
We suppose to have an *App4* application that returns after a certain amount of time.
|
|
|
|
|
|
For example in C++:
|
|
|
|
|
|
```cpp
|
|
|
// Connect the application "App4" and obtain a reference to the running app.
|
|
|
std::unique_ptr<cameo::application::Instance> app4 = server.connect("App4");
|
|
|
|
|
|
// Wait for the end of the app and get the terminal state.
|
|
|
cameo::application::State state = app4->waitFor();
|
|
|
|
|
|
// Get the exit code.
|
|
|
int exitCode = app4->getExitCode();
|
|
|
```
|
|
|
|
|
|
To get the value of the exit code of the app with the console depends on the *shell* you use.
|
|
|
With a bash shell:
|
|
|
```
|
|
|
$ cmo exec App4
|
|
|
The application App4.13 terminated successfully.
|
|
|
$ echo $?
|
|
|
```
|
|
|
|
|
|
# Stop handler
|
|
|
|
|
|
|