From: Silas S. <si...@gm...> - 2012-11-12 02:06:44
|
Hi all! I use ion3 and now notion for about 4 years, first in GNU/Linux and now in NetBSD. In NetBSD, I started to customize my statusbar with statusd scripts, adapting some from contrib and making some of them myself. But, I had to make some ugly changes on them. In order to make external commands work, I had to add os.execute("sleep 1") just after io.popen(). Yes, it worked and since I didn't have time to investigate the problem, I worked that way a long time. Now I decided to investigate the problem further. I made a small statusd_test.lua script: local test_timer = statusd.create_timer() local function update_test() local f = io.popen('echo x', 'r') os.execute("sleep 1") local value = f:read('*all') statusd.inform("test", value) test_timer:set(1000, update_test) end update_test() Without os.execute("sleep 1"), I receive: test: x . test: (null) . test: (null) ... But, with os.execute("sleep 1"), it works fine. I soon realized that time events were generated by SIGALRM. So there could be anything related with signals. So, my investigations confirm that a minor change is necessary to make it work. Just comment line 543 of libmainloop/signal.c: sigaction(SIGCHLD, &sa, NULL); And it works like a charm, but I don't know if it breaks other things. I'm not a C programmer expert. So I'd like to ask you if you know why it could be happening. If it works under GNU/Linux, it is probably something regarding implementation of signals in NetBSD. Do you have any idea? Why SIGCHLD is being intercepted? Thanks in advance. -- Silas Silva |