libcryfs/test/cpp-utils/process/exit_status.cpp

17 lines
387 B
C++
Raw Normal View History

2018-07-09 04:34:08 +02:00
// This is a small executable that prints its first argument and exits with the exit status in its second argument
#include <iostream>
2018-08-08 03:04:32 +02:00
#include <cstdlib>
2018-07-09 04:34:08 +02:00
int main(int argc, char* argv[]) {
if (argc != 3) {
std::cerr << "Wrong number of arguments" << std::endl;
2018-08-08 03:04:32 +02:00
std::abort();
2018-07-09 04:34:08 +02:00
}
std::cout << argv[1];
2018-10-14 22:26:30 +02:00
int exit_status = std::strtol(argv[2], nullptr, 10);
2018-07-09 04:34:08 +02:00
return exit_status;
}