main: require argv[0]

sure, linux has been providing argv[0] by default for a while now. other
OSes may not be as forthcoming though, and relying on the OS to create a
world in which we can just make assumptions we could test for instead is
unnecessarily lazy. we *could* default argv0, but that's a little silly.

notably we abort instead of returning normally to avoid confusions where
a caller interprets our exit status like a Worker build results bitmask.

Change-Id: Id73f8cd0a630293b789c59a8c4b0c4a2b936b505
This commit is contained in:
eldritch horrors 2024-08-09 00:58:38 +02:00
parent 6491cde997
commit baa4fda340

View file

@ -503,6 +503,11 @@ void mainWrapped(int argc, char * * argv)
int main(int argc, char * * argv) int main(int argc, char * * argv)
{ {
if (argc < 1) {
std::cerr << "no, we don't have pkexec at home. provide argv[0]." << std::endl;
std::abort();
}
// Increase the default stack size for the evaluator and for // Increase the default stack size for the evaluator and for
// libstdc++'s std::regex. // libstdc++'s std::regex.
nix::setStackSize(64 * 1024 * 1024); nix::setStackSize(64 * 1024 * 1024);