Ticket #760: readline_eof.patch

File readline_eof.patch, 1.1 KB (added by flh, 6 years ago)

Readline sets EOF in FileHandle and HLLCompiler checks EOF

  • src/pmc/filehandle.pmc

     
    368368            string_result = Parrot_str_new(INTERP, r, 0); 
    369369            mem_sys_free(r); 
    370370        } 
     371        else { 
     372            Parrot_io_set_flags(interp, SELF, 
     373                (PARROT_FILEHANDLE(SELF)->flags | PIO_F_EOF)); 
     374        } 
    371375#else 
    372376        if (got_prompt) 
    373377            fprintf(stderr, "%s", prompt->strstart); 
  • compilers/pct/src/PCT/HLLCompiler.pir

     
    591591 
    592592    ##  display a prompt ourselves if readline isn't present 
    593593  interactive_read: 
     594    $I0 = isfalse stdin # check if we've reached EOF 
     595    if $I0 goto interactive_end 
    594596    code = stdin.'readline_interactive'(prompt) 
    595     if null code goto interactive_end 
    596597    unless code goto interactive_loop 
    597598    concat code, "\n" 
    598599    push_eh interactive_trap