Hi Alexander, >> Looking at source code I now think you are checking for this specifically >> in >> MirrorJob::va_Report >> >> pid_t p=tcgetpgrp(fileno(stdout)); >> if(p!=-1 && p!=getpgrp()) >> return; >> >> I assume this means lftp won't print anything when there is no controlling >> terminal and there is no controlling terminal for processess run by cron. > > Not quite. It won't print when there _is_ a controlling terminal and lftp > is not in foreground process group.
Yep. > In fact, when lftp is run under cron the stdout is not a terminal at all. > So I assumed that when a file is not a terminal, then tcgetpgrp should return > -1 and the report line will be output. Probably FreeBSD works differently. I just checked FreeBSD 5 & FreeBSD 4. Both return the following when a command is run by cron: tcgetpgrp(fileno(stdout)) = 0 tcgetpgrp(fileno(stdin)) = 0 getpgrp() = 88888 getpgrp is different every time :) but tcgetpgrp is returning 0 all the time when run by cron. So I would suggest changing if(p!=-1 && p!=getpgrp()) return; to if(p!=-1 && p!=0 && p!=getpgrp()) return; I would assume it's safe for Linux as well... > So tcgetpgrp should return -1 and set errno to ENOTTY. If FreeBSD does > not do this, it is a bug. That I don't know :( Thanks! -- Michael
