Hi, all,
It seems that one more spawn flag will be useful: SPAWN_LEAVE_STDIN_OPEN.
Suppose that you need to send data to your child not constantly, but
only from time to time (possibly after sending some startup data). You
should to discard the initial stdin callback/source, to prevent it from
being called when there is no data to send (and since the stdin channel
is free, the callback is invoked constantly and raises high CPU usage).
Normally you would reference the channel, remember it, return FALSE to
discard the initial callback, and create a new callback/source each time
you have data to send (glib does not allow re-attaching a removed
source). The problem with the current implementation is, as soon you
return FALSE, spawn shutdowns (closes) the channel completely.
You may assume that g_io_channel_set_close_on_unref() will handle
everything gracefully, but at least under Windows, if the child reads
it's stdin until EOF (for example cat), so the channel must be closed
explicitly on our end, glib will fail to auto-close it on unref (or even
block? because the child is alive? I'm not sure about that).
So, SPAWN_LEAVE_STDIN_OPEN tells spawn not to shutdown the stdin
channel, because you may hold a reference to it. Unfortunately, I see no
official way to verify the ref_count of a GIOChannel.
Now, one can dup(g_io_channel_unix_get_fd(channel)), create and setup a
new channel, and leave the original one to be closed (it works, I've
checked), but that's seems unnecessarily complicated.
Thoughts? Maybe I'm missing something?
--
E-gards: Jimmy
Hi, all,
Should spawn_kill_process send a SIGTERM or SIGKILL to the child under *nix?
- SIGTERM lets the child exit gracefully, removing temporary files etc.
- the original build.c:kill_process from Geany <= 1.24 sends SIGTERM
- the child may refuse to terminate on SIGTERM (or be unable to respond
to it because of blocking I/O)
- under Windows, TerminateProcess() is an equivalent of SIGKILL, not SIGTERM
- the API name is "kill", not terminate.
--
E-gards: Jimmy
Hi,
I am an EE/CE engineering student with a little bit of experience in
C. I want to get involved in the open source community and I have heard
that Geany is a good starting point. I do not have an extensive knowledge
of C, but I use C basics almost daily in MATlab, Arduino, and
microprocessor applications that are translated to C. I am a very quick
learner and I want to get more involved in developing/debugging the open
source software that I use. I hope I can be of use to the Geany development
community.
Corey
Hi,
Is it possible to make an archived mailing list which can contain
threads of comments posted to Github (maybe using Github API)? We have
sometimes when squash commits it deletes Github comments, but I thought
maybe we could have some stable backup + URL to link to (ex. in commit
messages, on the mailing list, etc) which could be searchable and
googlable and not be deleted by rebase.
Cheers,
Matthew Brush