could not redirect output of idevicesyslog well
Reported by viewrain | December 20th, 2011 @ 10:04 AM
idevicesyslog goes well when I run it directly. But when I redirect its output, like "idevicesyslog > /tmp/log". It can only redirect the front part of output (say, 28672 byte) and cannot append the rest output any more.
So I cannot get the device's syslog automatically. I also wrote the code to run the command "idevicesyslog -u " and get the output, still only get the front part (32768 byte).
Why does it happen? Would you please help to fix it? Or we could not get the device's syslog automatically :(
Comments and changes to this ticket
-
viewrain December 20th, 2011 @ 04:09 PM
I took a look at the source code. I found it was the problem of the buffering of stdout.
In tools/idevicesyslog.c, I add one line "setvbuf(stdout, NULL, _IONBF, 0);" at the beginning of the main function to disable the buffering of stdout.
Then the new binary could redirect the output normally when I run "idevicesyslog > /tmp/log".Would you please modify the code or is there a better solution?
Thanks a lot~
-
Nikias Bassen January 11th, 2012 @ 11:02 PM
- State changed from new to resolved
- Tag set to idevicesyslog
I committed a fix using fflush to write out the buffer immediately after the fwrite call. This should fix the issue.
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป
A project around supporting the iPhone in Linux.
See http://libimobiledevice.org