-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Partial stdout even when child exist with status code 0 #3
Comments
One way of handling this situation: stdout(Drv, Chain) ->
stdout(Drv, Chain, []).
stdout(Drv, Chain, Acc) ->
case alcove:stdout(Drv, Chain) of
false ->
case Acc of
[] -> false;
_ -> lists:reverse(Acc)
end;
Out ->
stdout(Drv, Chain, [Out|Acc])
end. But I think you are correct and % current
-spec stdout(alcove_drv:ref(),[pid_t()]) -> 'false' | binary().
% proposed
% [] is returned if no stdout available
-spec stdout(alcove_drv:ref(),[pid_t()]) -> [binary()]. I will take a look at making this change! |
@msantos it makes sense now. I faced a similar situation when reading from java and python processes wherein the logs were not flushed entirely, but my latest test confirmed the issue (ref beamparticle/beamparticle#29). Thanks for looking. |
Change stdout/2,3 and stderr/2,3 to return a list of values as discussed in: #3 The spec is changed from: % from -spec stdout(alcove_drv:ref(),[pid_t()]) -> 'false' | binary(). % to: [] indicates no stdout -spec stdout(alcove_drv:ref(),[pid_t()]) -> [binary()]. In the case where an unreponsive child causes the pipe buffer between the alcove parent process and the child to fill up, stdout/2,3 and stderr/2,3 will now both crash. If the caller wants to handle this situation, e.g., to wait and retry, the `alcove_pipe` message can be processed directly from the mailbox. Thanks @neeraj9!
Change has been pushed, thanks @neeraj9 ! I looked at beamparticle/beamparticle#29. The writes might be buffered so the external process may need to explicitly do an fflush(). These writes can be forced to be flushed by default using stdbuf(1):
Or by setting some magic environment variables:
|
Thanks @msantos ! |
It appears the stdout from a child process is not flushed entirely even when it exists.
The execute_command/5 is as follows:
The output (stdout) gives a partial listing for SHA-1 hashes (see below). Additionally, notice that the first time it gave two hashes (which is also less) and the second time just one.
The text was updated successfully, but these errors were encountered: