Leopold Toetsch <[EMAIL PROTECTED]> writes: > Arthur Bergman <[EMAIL PROTECTED]> wrote: > > Hi Arthur, > > > Hi, > > > If I execute a miniperl (but linked into parrot and with it's own > > parrot interpreter) it works, but if the caller closes(STDERR) before > > invoking miniperl no output is ever seen on STDOUT. > > Parrot's IO system is currently reworked heavily and its not finished > yet. I'm sure Juergen Boemmels comes up with a solution for this.
One problem is that the parrot interpreter closes the filehandles when it is finished with it. This is wrong for the standard handles. They come from an external source and should not be closed on interpreter exit, just flushed. I think thats nothing special of the standard handles but this should be the default behaviour of all fdopened files. > > This is terribly annoying since ExtUtils::MakeMaker does silly things > > like this, could there be some code in parrot that becomes really > > unhappy if STDERR is not open? No STDERR should not let the init fail, but might set the handle to PerlUndef. This is possible since the standard handles are PMCs now. In this case the write to the closed handle will fail, but not the just the fact that STDERR is closed. Another possibility would be to redirect STDERR to something like /dev/null, maybe via an PIO_null_layer. This way a write to the closed STDERR will be just ignored. > >From a quick look at it I would think: > > io/io_unix.c:PIO_unix_init returns -1: > > io = PIO_unix_fdopen(interpreter, layer, STDERR_FILENO, PIO_F_WRITE); > if (!io) return -1; The init function should not fail on a closed handle. > which calls internal_exception in io/PIO_init() > > if (!PIO_STDIN(interpreter) || !PIO_STDOUT(interpreter) > || !PIO_STDERR(interpreter)) { > internal_exception(PIO_ERROR, "PIO init std handles failed."); > } > > which is the end of the interpreter, but never seen, because the message > goes to STDERR. There is no clean way to get this message ever. If there is no STDERR then even fprintf will fail. bye boe -- Juergen Boemmels [EMAIL PROTECTED] Fachbereich Physik Tel: ++49-(0)631-205-2817 Universitaet Kaiserslautern Fax: ++49-(0)631-205-3906 PGP Key fingerprint = 9F 56 54 3D 45 C1 32 6F 23 F6 C7 2F 85 93 DD 47