Hi Monks,
I need to know if there is some way to read data into buffer and mentioning the bytes to read dynamically ?
I am currently executing something like this
$chan->shell();
$chan->write("egrep -l $searchStr * 2>&1 | tee ~/myfile.txt\n");
the above can have multiple lines as output or jus a single line or nothing at all. After this I have the read call.
$chan->read($buf, 512);
here if the ouput of the egrep does not have 512 bytes, the read call waits until it reads 512.
If I make the channel as non-blocking, then the read call does not complete and I do not get the desired result stored in the file - myfile.txt
please let me know if there is a work-around for this or I am missing something ?
J
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.