mirror of
https://github.com/catchorg/Catch2.git
synced 2025-08-01 12:55:40 +02:00
Cap main exit code to 255 (#797)
Changed default main to clamp exit code to 8 bits because of POSIX limitations. Updated documentation about declaring non-default main.
This commit is contained in:

committed by
Martin Hořeňovský

parent
7dd4f2977a
commit
1e5176bd69
@@ -12,7 +12,8 @@
|
||||
|
||||
// Standard C/C++ main entry point
|
||||
int main (int argc, char * argv[]) {
|
||||
return Catch::Session().run( argc, argv );
|
||||
int result = Catch::Session().run( argc, argv );
|
||||
return ( result < 0xff ? result : 0xff );
|
||||
}
|
||||
|
||||
#else // __OBJC__
|
||||
@@ -30,7 +31,7 @@ int main (int argc, char * const argv[]) {
|
||||
[pool drain];
|
||||
#endif
|
||||
|
||||
return result;
|
||||
return ( result < 0xff ? result : 0xff );
|
||||
}
|
||||
|
||||
#endif // __OBJC__
|
||||
|
Reference in New Issue
Block a user