read(0, "load(\'jslint.js\');\nfoo=0;\nEND\n", 1024) = 30 read(0, "", 1024) = 0 read(0, "", 1024) = 0 close(0) = 0 <-- !!! munmap(0xb7b8a000, 4096) = 0 brk(0x8092000) = 0x8092000 open("jslint.js", O_RDONLY) = 0

I think the problem is this close(0). Because of it, the file descriptor is being reused in the subsequent open("jslint.js" (as the lowest available file descriptor) when the js interpreter is reading in the jslint.js file, at the end of which it gets closed again... Anyhow, the net effect of this is that stdin (which is expected to be connected to the pipe) is no longer open when your line=readline() is trying to read from it. Thus the readline is failing, and the while (true) {...} keeps looping forever...

Note that when being run interactively, the jslint.js file is read in via a different file descriptor, and stdin (file descriptor 0) can still be read from afterwards.

I'd suspect the undesirable close(0) has to do with you closing the other end of the pipe ($JSWRITE) before the js interpreter starts executing the load('jslint.js'); command you sent it.  So that's where I would start fiddling... (if I really wanted to know :)


In reply to Re: Calling strace -f by almut
in thread Diagnosing blocking io (or: finding the WHY of my Open2 woes). by Socrates

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.