mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 20:27:45 +00:00
pkill: Print errors when killing a process to stderr
This commit is contained in:
parent
e252b6e258
commit
6753cf8b20
1 changed files with 5 additions and 3 deletions
|
@ -1,5 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2022, Maxwell Trussell <maxtrussell@gmail.com>
|
* Copyright (c) 2022, Maxwell Trussell <maxtrussell@gmail.com>
|
||||||
|
* Copyright (c) 2023, Tim Ledbetter <timledbetter@gmail.com>
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
@ -59,10 +60,11 @@ ErrorOr<int> serenity_main(Main::Arguments args)
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto& process : matched_processes) {
|
for (auto& process : matched_processes) {
|
||||||
if (echo) {
|
auto result = Core::System::kill(process.pid, signal);
|
||||||
|
if (result.is_error())
|
||||||
|
warnln("Killing pid {} failed. {}", process.pid, result.release_error());
|
||||||
|
else if (echo)
|
||||||
outln("{} killed (pid {})", process.name, process.pid);
|
outln("{} killed (pid {})", process.name, process.pid);
|
||||||
}
|
|
||||||
kill(process.pid, signal);
|
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue