« first day (4025 days earlier)      last day (45 days later) » 

7:42 AM
@MichaelHomer man pipe only has one example. It starts with:
> The following program creates a pipe, and then fork(2)s to create a child process; the child inherits a duplicate set of file descriptors that refer to the same pipe.
Is that what you are referring to?
 
Yes. You also use dup2 to put them in stdout/stderr
 
 
1 hour later…
8:54 AM
@MichaelHomer OK. I'll take a look. Thanks.
 
 
4 hours later…
12:58 PM
It seems that wkhtml sends warnings to standard error. Is that correct procedure? I've never thought about the issue, but it seems to me that warnings should go to standard output.
Actually, if stackoverflow.com/a/2342841/350713 is correct, it's sending everything, including stuff that anyone would consider to go to standard output, to standard error.
It looks like this:
    Loading page (1/2)
[>                                                           ] 0%^M[====================>                                       ] 34%^M[======================>                                     ] 37%^MWarning: Failed to load karisma.kfintech.com/files/mailer_newsletbottom.gif (ignore)
Warning: Failed to load karisma.kfintech.com/files/mailer_newslettop.gif (ignore)
[========================>                                   ] 40%^M[============================================================] 100%^MPrinting pages (2/2)
Why would one send a progress bar to standard error? Weird.
A search doesn't bring up anything. Can anyone reproduce this?
 
1:15 PM
Aug 27 '19 at 13:20, by Kusalananda
"Standard error" is a misnomer. It should really be called "standard other".
See what was said in that conversation, including the question terdon linked to.
I agree it looks weird to see non-error messages to the user on a stream called "standard error", but it would probably be weirder if those messages to the user were sent on standard output along with the commands' "regular" output.
 
 
3 hours later…
3:51 PM
@fra-san Apparently I've had this conversation here before. And probably not for the first time.
It seems to be there should be three streams, if you really want to go that way. I still think standard error should be reserved for actual errors.
 
4:42 PM
@FaheemMitha Maybe. I seemed to recall I had already seen it ;-)
 
Currently my code checks whether standard error is non-empty, and if so, errors out. Is that the wrong thing to do, then? And if so, what is the right thing to do?
 
@FaheemMitha It depends, I'd guess. What are you trying to accomplish?
 
@fra-san Trying to Lua function that executes a command, and exits if there is an error.
Which really ought to be a solved problem, but Lua.
 
Oh, so you are checking whether errors were printed out (by a shell command) from your Lua code, right?
Unfortunately I know nothing about Lua, sorry.
 
@fra-san Right.
@fra-san Kind of stating the obvious here, but this issue has nothing to with Lua. Lua is just an unimportant detail.
The issue is, how does one correctly determine whether an error has occurred?
 
4:54 PM
@FaheemMitha By checking the command's exit status, I'd say.
(Probably stating the obvious here, too...)
 
@fra-san Yes, I thought someone would say that. Is that the gold standard, then? And the actual standard error is not determinative of whether an error has occurred?
@fra-san I guess so. But sometimes the obvious is the easiest thing to overlook.
 
5:22 PM
@FaheemMitha I wouldn't know. But, when doing it programmatically, I'd expect the exit status to be a way more reliable and easy way to check for errors.
 
5:59 PM
@fra-san I'm a bit surprised to hear you say that. I'm used to people speaking with authoritative certainty around here. :-)
 
 
1 hour later…
7:05 PM
@FaheemMitha I hope I haven't spoken with such certainty too often, especially since I don't think I'm authoritative on any of the topics usually discussed here.
 
7:16 PM
@fra-san Honestly, I don't recall. But I don't think we've had a lot of discussions here.
 
 
1 hour later…
8:23 PM
I'm trying to understand this Lua program, but I'm lost at the beginning, when the poster creates 3 pipes, and then checks if they failed.
6
A: How do you construct a read-write pipe with lua?

KyleI stumbled on this post while trying to do the same thing and never found a good solution, see the code below for how I solved my issues. This implementation allows users to access stdin, stdout, stderr and get the return status code. A simple wrapper is called for simple pipe calls. require("...

I'm unclear why he creates three pipes, and also why he checks for success and failure when he hasn't done anything with them, and why he is making the checks he is.
 
have you tried reading the subsequent lines to see if they shed any light on why there are three pipes?
 
Oh, those pipes get passed on to the fork and then the child closes one end. OK. Still don't understand what those checks are for. Why would those pipe creation actions fail?
@MichaelHomer Working on it.
 
have you tried looking at the errors section of man pipe to see why it may fail?
 
@MichaelHomer Not yet.
I'm currently reading the respective man pages. If anyone can suggest something chattier (and maybe better), let me know.
@MichaelHomer Some stuff about system limits.
I wonder if that is an issue in practice.
 
9:11 PM
I think assert((w1 ~= nil or r2 ~= nil or r3 ~= nil), "pipe() failed") should be assert((r1 ~= nil or r2 ~= nil or r3 ~= nil), "pipe() failed"). Per the Lua Posix documention, nil is returned if the pipe creation fails. If it's correct, please explain to me why. — Faheem Mitha 19 secs ago
Though if it's indeed wrong, I'm surprised that has sat there for over 8 years without anyone commenting on it.
But I can't fathom any reason for treating the first of three identical constructions differently from the others.
If people here agree, I might venture an edit.
 

« first day (4025 days earlier)      last day (45 days later) »