sam-fans - fans of the sam editor
 help / color / mirror / Atom feed
* Re: Pipe problem?
@ 1992-11-20  0:38 Alan Watson
  0 siblings, 0 replies; 2+ messages in thread
From: Alan Watson @ 1992-11-20  0:38 UTC (permalink / raw)
  To: sam-fans

There appears to be at least two things going on here.

There is a simple bug in sam, which causes the "producer" process which
feeds dot into the "consumer" process created by the pipe command, to
exit with the wrong status.  The diffs to correct this bug are below.

However, waitfor should filter out this non-zero status, as it does not
come from the "consumer" process; apparently it does behave correctly
under SunOS, but not under Ultrix 4.2 or 4.3.  I can neither fault
waitfor's logic nor reproduce this behaviour with a simple program.  I'm
giving up for now, but if anyone can figure this one out I'd very much
like to hear an explanation.

Alan.

*** shell.c     Thu Nov 19 18:22:18 1992
--- ../Orig/sam/shell.c Thu Nov 19 18:19:55 1992
***************
*** 79,85 ****
                                                free(c);
                                        }
                                }
!                               exits(retcode? 0 : "error");
                        }
                        if(pid==-1){
                                fprint(2, "Can't fork?!\n");
--- 79,85 ----
                                                free(c);
                                        }
                                }
!                               exits(retcode? "error" : 0);
                        }
                        if(pid==-1){
                                fprint(2, "Can't fork?!\n");



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Pipe problem?
@ 1992-11-19 19:56 Alan Watson
  0 siblings, 0 replies; 2+ messages in thread
From: Alan Watson @ 1992-11-19 19:56 UTC (permalink / raw)
  To: sam-fans

Before I investigate further, has anyone come across this sort of
a problem with the pipe (|) command:

	; sam -d
	a
	Hello world!
	.
	,p
	Hello world!
	|/bin/cat
	?warning: exit status not 0
	!
	,p
	Hello world!
	|wc
	?warning: exit status not 0
	!
	,p
	      1       2      13
	q
	?changed files
	q
	;

I checked "waitfor", and the child processes really are exiting with
non-zero status!  I'm on a Decstation running Ultrix 4.3, and I
compiled sam with gcc in POSIX mode.

Alan.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1992-11-20  0:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1992-11-20  0:38 Pipe problem? Alan Watson
  -- strict thread matches above, loose matches on Subject: below --
1992-11-19 19:56 Alan Watson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).