From bdeb9f95651f6c99cc2f4cfb59020ddee202cf36 Mon Sep 17 00:00:00 2001 From: Ronan Pigott Date: Wed, 16 Nov 2022 15:50:34 -0700 Subject: launcher: fudge the interface a bit We want to create a context before knowing the pid it will match with. --- sway/commands/exec_always.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'sway/commands') diff --git a/sway/commands/exec_always.c b/sway/commands/exec_always.c index 0d3254ae..13deb9e3 100644 --- a/sway/commands/exec_always.c +++ b/sway/commands/exec_always.c @@ -53,6 +53,7 @@ struct cmd_results *cmd_exec_process(int argc, char **argv) { } pid_t pid, child; + struct launcher_ctx *ctx = launcher_ctx_create(); // Fork process if ((pid = fork()) == 0) { // Fork child process again @@ -92,8 +93,12 @@ struct cmd_results *cmd_exec_process(int argc, char **argv) { waitpid(pid, NULL, 0); if (child > 0) { sway_log(SWAY_DEBUG, "Child process created with pid %d", child); - launcher_ctx_create(child); + if (ctx != NULL) { + sway_log(SWAY_DEBUG, "Recording workspace for process %d", child); + ctx->pid = child; + } } else { + launcher_ctx_destroy(ctx); return cmd_results_new(CMD_FAILURE, "Second fork() failed"); } -- cgit v1.2.3-54-g00ecf