[comp.lang.perl] msdos/popen

serow@octavia.ibix.co.jp (Yoshitomo Tanaka) (02/18/91)

In msdos version of perl(v3 pl44 compiled with MS-C6.00 on MSDOS3.2)
		open(OUTPUT, "|cmd");
does not work correctly, for the reason that
execute cmd before closeing tmp file 'pp'  I think..
I did following modification and works fine.


*** msdos/popen.c.old	Fri Feb  1 17:35:14 1991
--- msdos/popen.c	Mon Feb 18 13:33:00 1991
***************
*** 145,154 ****
  			case execute:
  				(void)sprintf(buff, "%s <%s", p->command, p->name);
  				free(p);
! 				if (system(buff)) {
  					(void)unlink(name);
  					status = EOF;
! 				} else if (fclose(f) == EOF) {
  					(void)unlink(name);
  					status = EOF;
  				} else if (unlink(name) < 0)
--- 145,154 ----
  			case execute:
  				(void)sprintf(buff, "%s <%s", p->command, p->name);
  				free(p);
! 				if (fclose(f) == EOF) {
  					(void)unlink(name);
  					status = EOF;
! 				} else if (system(buff)) {
  					(void)unlink(name);
  					status = EOF;
  				} else if (unlink(name) < 0)
--------------------
-+--+-      Yoshitomo Tanaka
 |  '       serow@ibix.co.jp
 \---

lbr@holos0.uucp (Len Reed) (02/22/91)

In article <SEROW.91Feb18144126@octavia.ibix.co.jp> serow@octavia.ibix.co.jp (Yoshitomo Tanaka) writes:
>
>In msdos version of perl(v3 pl44 compiled with MS-C6.00 on MSDOS3.2)
>		open(OUTPUT, "|cmd");
>does not work correctly, for the reason that
>execute cmd before closeing tmp file 'pp'  I think..

Just one of dozens of bugs that have been fixed and released in binary form
on comp.binaries.ibm.pc (though at level 41).  That binary is far ahead
of level 44 MS-DOS version you'll get by building from the source kit.
(In addition to the bug fixes there are some major DOSsy enhancements, the
biggest one being that there's a swapping mechanism that allows you to
run something other than toy-sized subprocesses.)

Larry has the patches, and has made the binary available for ftp at his site,
but hasn't put the patches into the source distribution.   Perhaps after
4.0 comes out...

-Len
-- 
Len Reed
Holos Software, Inc.
Voice: (404) 496-1358
UUCP: ...!gatech!holos0!lbr