aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam <adamdharrison@gmail.com>2022-10-04 19:41:03 -0400
committerAdam <adamdharrison@gmail.com>2022-10-04 19:41:03 -0400
commit0cf16cf4d69ba0c35147243ffb92d9925a88a204 (patch)
tree7f2a0f6e1ca2b0de128355ee8b346103c6f9f1ef
parentc79ff290bfedf6e415c9216027c5d05a28a3afe7 (diff)
downloadlite-xl-fix-pgid-on-deatch.tar.gz
lite-xl-fix-pgid-on-deatch.zip
Added in variable to check detached state on cleanup, so we don't send TERM.fix-pgid-on-deatch
-rw-r--r--src/api/process.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/api/process.c b/src/api/process.c
index a528e735..82842176 100644
--- a/src/api/process.c
+++ b/src/api/process.c
@@ -29,7 +29,7 @@ typedef int process_handle;
#endif
typedef struct {
- bool running;
+ bool running, detached;
int returncode, deadline;
long pid;
#if _WIN32
@@ -38,7 +38,7 @@ typedef struct {
bool reading[2];
char buffer[2][READ_BUF_SIZE];
#endif
- process_handle child_pipes[3][2];
+ process_handle child_pipes[3][2];
} process_t;
typedef enum {
@@ -183,6 +183,7 @@ static int process_start(lua_State* L) {
memset(self, 0, sizeof(process_t));
luaL_setmetatable(L, API_TYPE_PROCESS);
self->deadline = deadline;
+ self->detached = detach;
#if _WIN32
for (int i = 0; i < 3; ++i) {
switch (new_fds[i]) {
@@ -455,7 +456,8 @@ static int f_kill(lua_State* L) { return self_signal(L, SIGNAL_KILL); }
static int f_interrupt(lua_State* L) { return self_signal(L, SIGNAL_INTERRUPT); }
static int f_gc(lua_State* L) {
process_t* self = (process_t*) luaL_checkudata(L, 1, API_TYPE_PROCESS);
- signal_process(self, SIGNAL_TERM);
+ if (!self->detached)
+ signal_process(self, SIGNAL_TERM);
close_fd(&self->child_pipes[STDIN_FD ][1]);
close_fd(&self->child_pipes[STDOUT_FD][0]);
close_fd(&self->child_pipes[STDERR_FD][0]);