[SLL] curl question...

Robert Woodcock rcw at blarg.net
Thu Jun 12 14:34:55 PDT 2008


On Thu, Jun 12, 2008 at 02:12:56PM -0700, Xeno Campanoli wrote:
> Xeno Campanoli wrote:
> >I'm doing curl on a special resource URL that I cannot mention outside 
> >my task.  I redirect all output with >mess.lst 2>mess2.lst, but I'm 
> >getting "Other Output".  Anyone know what that could be?  I didn't know 
> >HTTP did other channels.
> >
> What appears to be happening is curl is talking to something or does 
> something to spawn a whole bunch of processes, then, I think what is 
> happening is the stdout that comes back from all those processes doesn't 
> go into my recirected stdout

Test that theory by running curl under strace.

strace -f should show you any fork()s and/or execve()s for subprocesses.

It should also show you all the file descriptors ("channels") curl opens. By
default, fd 0 is stdin, 1 is stdout, and 2 is stderr. Any other descriptors
(3, 4, 5, 6...) would not by default be associated with your tty. If the
code did try and associate them, I'd expect to see that done with an open()
or dup2() call. More likely, though, I'd expect curl to use other
descriptors for stuff like file system access and DNS/HTTP socket
communications.

$() would only return the contents of stdout, not stderr. $() doesn't
intercept stderr at all:

$ foo=$(echo bar >&2)
bar
$ echo $foo

$


BTW, if you don't actually want stdout and stderr separated, use
"curl >blah 2>&1" instead.
-- 
Robert Woodcock - rcw at blarg.net
perl -e '$a-=($_%4-2)*4/$_++while++$_<2e6;print"$a\n"'



More information about the linux-list mailing list