server: send SIGTERM to startup process on exit
This commit is contained in:
parent
9dd18c6373
commit
3752a7879b
@ -16,9 +16,12 @@ bspwm based on wlroots and written in Zig.
|
||||
|
||||
*-c* _shell_command_
|
||||
Run a shell command or give the path to a script that will be run
|
||||
before river gets started. This is where you define keymaps using
|
||||
*riverctl*(1) and autostart programs. Make sure the script is
|
||||
executable.
|
||||
after river's wayland server is initialized but before entering the
|
||||
main loop. You may use this to configure river and define keymaps
|
||||
using *riverctl*(1), start programs such as a status bar, or perhaps
|
||||
run a service manager. If the process started by this flag is still
|
||||
running when river exits, river will send SIGTERM and and wait for it
|
||||
to terminate.
|
||||
|
||||
*-l* _log_level_
|
||||
Set the log level of river to a value from 0 to 7 with 0 being the
|
||||
|
@ -85,12 +85,15 @@ pub fn main() anyerror!void {
|
||||
|
||||
try server.start();
|
||||
|
||||
if (startup_command) |cmd| {
|
||||
const startup_process = if (startup_command) |cmd| blk: {
|
||||
const child_args = [_][]const u8{ "/bin/sh", "-c", cmd };
|
||||
const child = try std.ChildProcess.init(&child_args, util.gpa);
|
||||
defer child.deinit();
|
||||
try std.ChildProcess.spawn(child);
|
||||
}
|
||||
break :blk child;
|
||||
} else null;
|
||||
defer if (startup_process) |child| {
|
||||
_ = child.kill() catch |e| log.err(.server, "failed to terminate startup process: {}", .{e});
|
||||
};
|
||||
|
||||
log.info(.server, "running...", .{});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user