From 7546c236db6b306aba59522c7b27748b501c9851 Mon Sep 17 00:00:00 2001 From: actionless Date: Tue, 15 Dec 2015 11:32:53 +0100 Subject: [PATCH] feat(spawn, lib: awful: spawn: with_line_callback): make callbacks optional --- lib/awful/spawn.lua | 4 +++- spawn.c | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/awful/spawn.lua b/lib/awful/spawn.lua index 3aa432dc3..09a0bd0f3 100644 --- a/lib/awful/spawn.lua +++ b/lib/awful/spawn.lua @@ -123,7 +123,9 @@ function spawn.with_line_callback(cmd, callbacks) done_before = true return end - done_callback() + if done_callback then + done_callback() + end end if have_stdout then spawn.read_lines(Gio.UnixInputStream.new(stdout, true), diff --git a/spawn.c b/spawn.c index bdf715aec..3762f8124 100644 --- a/spawn.c +++ b/spawn.c @@ -402,7 +402,7 @@ luaA_spawn(lua_State *L) return_stdout = luaA_checkboolean(L, 4); if(lua_gettop(L) >= 5) return_stderr = luaA_checkboolean(L, 5); - if(lua_gettop(L) >= 6) + if (!lua_isnoneornil(L, 6)) { luaA_checkfunction(L, 6); flags |= G_SPAWN_DO_NOT_REAP_CHILD;