 +    g_source_remove_by_user_data(p); // disconnect cstdout watch
 +    g_source_remove_by_user_data(p); // disconnect cstderr watch
 +    g_source_remove_by_user_data(p); // disconnect child watch
++    g_spawn_close_pid(p->pid);
 +  }
 +  return 0;
 +}

+    if (lua_pcall(L, 1, 0, 0) != LUA_OK)
+      fprintf(stderr, "Lua: %s\n", lua_tostring(L, -1)), lua_pop(L, 1);
+  }
+#if _WIN32
+  close(p->pid);
+#elif (!GTK || __APPLE__)
+  // Stop tracking and monitoring this proc.
+  lua_getfield(L, LUA_REGISTRYINDEX, "spawn_procs");

 #endif			/* } */
 
 
--- a/src/loslib.c	2022-02-27 11:51:08.935094072 -0500
+++ b/src/loslib.c	2022-02-26 18:43:06.214717620 -0500
@@ -4,6 +4,15 @@
 ** See Copyright Notice in lua.h
 */
