24 lines
637 B
C++
24 lines
637 B
C++
#include <os/ArgumentParser.h>
|
|
#include <os/Process.h>
|
|
#include <stdlib.h>
|
|
|
|
Result<int> luna_main(int argc, char** argv)
|
|
{
|
|
StringView signo_sv = "15";
|
|
StringView process;
|
|
|
|
os::ArgumentParser parser;
|
|
parser.add_description("Send a signal to another process."_sv);
|
|
parser.add_system_program_info("kill"_sv);
|
|
parser.add_value_argument(signo_sv, 's', "signal", "the signal number to send");
|
|
parser.add_positional_argument(process, "pid", true);
|
|
parser.parse(argc, argv);
|
|
|
|
int signo = atoi(signo_sv.chars());
|
|
pid_t pid = atoi(process.chars());
|
|
|
|
TRY(os::Process::kill(pid, signo));
|
|
|
|
return 0;
|
|
}
|