mirror of
https://github.com/uselessd/alcove.git
synced 2026-04-15 17:25:33 +00:00
Always treat stderr as a stream
Using exact reads for processes running the event loop broke stderr.
This commit is contained in:
@@ -331,7 +331,8 @@ alcove_child_stdio(int fdin, alcove_child_t *c, u_int16_t type)
|
||||
*
|
||||
* Otherwise, read in the length header and do an exact read.
|
||||
*/
|
||||
if (c->fdctl == ALCOVE_CHILD_EXEC)
|
||||
if ( (c->fdctl == ALCOVE_CHILD_EXEC)
|
||||
|| type == ALCOVE_MSG_STDERR)
|
||||
read_len = MAXMSGLEN;
|
||||
|
||||
n = read(fdin, buf, read_len);
|
||||
@@ -343,7 +344,8 @@ alcove_child_stdio(int fdin, alcove_child_t *c, u_int16_t type)
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (c->fdctl != ALCOVE_CHILD_EXEC) {
|
||||
if ( (c->fdctl != ALCOVE_CHILD_EXEC)
|
||||
&& (type != ALCOVE_MSG_STDERR)) {
|
||||
n = buf[0] << 8 | buf[1];
|
||||
|
||||
if (alcove_read(fdin, buf+2, n) != n)
|
||||
|
||||
@@ -123,13 +123,19 @@ setopt({_, Port, _Child}) ->
|
||||
Opt2 = alcove:getopt(Port, [], maxforkdepth),
|
||||
Opt3 = alcove:getopt(Port, [Fork], maxforkdepth),
|
||||
Reply = alcove:fork(Port, [Fork]),
|
||||
|
||||
ok = alcove:setopt(Port, [Fork], verbose, 2),
|
||||
Fork = alcove:getpid(Port, [Fork]),
|
||||
Stderr = alcove:stderr(Port, [Fork]),
|
||||
|
||||
alcove:kill(Port, Fork, 9),
|
||||
|
||||
[
|
||||
?_assertEqual(0, Opt1),
|
||||
?_assertNotEqual(0, Opt2),
|
||||
?_assertEqual(0, Opt3),
|
||||
?_assertEqual({error,eagain}, Reply)
|
||||
?_assertEqual({error,eagain}, Reply),
|
||||
?_assertNotEqual(false, Stderr)
|
||||
].
|
||||
|
||||
sethostname({{unix,linux}, Port, Child}) ->
|
||||
|
||||
Reference in New Issue
Block a user