Standardize exit codes for samples.

Fixes #909 #910

PiperOrigin-RevId: 782951003
Change-Id: I093c0032f665bf34fecf71a75012b2b0c4c22aba
This commit is contained in:
Yuval Tassa
2025-07-14 10:14:36 -07:00
committed by Copybara-Service
parent 9a41d385c1
commit 5187a712be
4 changed files with 9 additions and 6 deletions
+3 -2
View File
@@ -13,6 +13,7 @@
// limitations under the License.
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <GLFW/glfw3.h>
@@ -104,7 +105,7 @@ int main(int argc, const char** argv) {
// check command-line arguments
if (argc!=2) {
std::printf(" USAGE: basic modelfile\n");
return 0;
return EXIT_FAILURE;
}
// load and compile model
@@ -186,5 +187,5 @@ int main(int argc, const char** argv) {
glfwTerminate();
#endif
return 1;
return EXIT_SUCCESS;
}
+2 -1
View File
@@ -16,6 +16,7 @@
#include <cctype>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
@@ -49,7 +50,7 @@ int finish(const char* msg = 0, mjModel* m = 0) {
std::cout << msg << std::endl;
}
return 0;
return EXIT_SUCCESS;
}
+2 -2
View File
@@ -219,7 +219,7 @@ int main(int argc, const char** argv) {
// check command-line arguments
if (argc < 5 || argc > 6) {
std::printf(" USAGE: record modelfile duration fps rgbfile [adddepth]\n");
return 0;
return EXIT_FAILURE;
}
// parse numeric arguments
@@ -321,5 +321,5 @@ int main(int argc, const char** argv) {
closeMuJoCo();
closeOpenGL();
return 1;
return EXIT_SUCCESS;
}
+2 -1
View File
@@ -14,6 +14,7 @@
#include <chrono>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ratio>
#include <string>
@@ -56,7 +57,7 @@ int finish(const char* msg = NULL, mjModel* m = NULL) {
std::printf("%s\n", msg);
}
return 0;
return EXIT_SUCCESS;
}
std::vector<mjtNum> CtrlNoise(const mjModel* m, int nsteps, mjtNum ctrlnoise) {