[Prev][Next][Index][Thread]

Re: fork & exec.




Did you try to reroute stderr to a file (2> or >&), wait untill the exec 
finishes his work, and then check the file?
It sounds clumsy, but I think it'll work.

On Tue, 5 Nov 1996, Asaf Sabag wrote:

> Amos, guys.
>  
> Maybe I did not make my self clear, 
> 
> When I do exec for /bin/tar the tar command is found and exec execute the tar.
> 
> For example:
> ------------
> 
> if (pid = fork() == 0) {
>  execid = execl("/bin/tar", "tar", "cvf", "/dev/fdo", 0)
>  perror("exec failed");
> }
> printf("exec passed\n");
> 
> the exec execute the tar and the exec passes OK.
> No error is printed.
> the massage : "exec passed" comes.
> 
> The problem is that if there is no disk in the drive or if there is no tar 
> file in it then the tar failes!
> 
> This leads to no error from exec! beacuse exec passed.
> and the massage "exec passed" comes, 
> 
> If I use the system command and tar failes I get an error masaage from tar.
> 
> For example:
> ------------
> 
> if (i = system("/bin/tar xvf /dev/fd0 > /tmp/TarList.txt") == 0)
>   XtManageChild(SysToolOBJ.DialogGoodExpand_ExpandDevice);
> else
>  XtManageChild(SysToolOBJ.ErrorMsgExpandFailed_ExpandDevice);
> 
> 
> I want to execute the same command with exec not system.
> But I don't get the error massage from tar within exec.
> 
> HOW can I make it work with exec???
> 
> BTW. I understand that there are no jumpers on the social life meetings???
> 
> Thanks,
> Asaf.
> 
> 
> --------------------------------------------------------
> Name   : Asaf Sabag NetManage - SQA Haifa
> E-mail : Asaf Sabag <asaf@netmanage.co.il>
> Date   : 11/05/96
> Time   : 09:55:54
> 
> This message was sent by Z-Mail Pro - from NetManage
> NetManage - delivers Standards Based IntraNet Solutions
> --------------------------------------------------------
> 
> 


		                	Bye for now...
			 
                        MM   MM   OOOO   SSSSS  H    H  EEEEEE       MM   MM
                       M M M M  O    O  S      H    H  E            M M M M
                      M  M  M  O    O  SSSSS  HHHHHH  EEEEE        M  M  M
                     M     M  O    O      S  H    H  E            M     M  ..
                    M     M   OOOO   SSSSS  H    H  EEEEEE       M     M  ..


E-Mail:  maorm@netvision.net.il
         s2543848@t2.technion.ac.il
Age:     23
Hobbies: Computers,Horror (books,movies...), Monty-Python, S.F. Writing,
         MicroGraphics.

                     "MICROSOFT, EST DENDA CENSEO, SENTEUM"


References: