[Ace-users] Pipes on Win32 and Unix
pivlev at gmail.com
pivlev at gmail.com
Thu Jan 31 05:51:29 CST 2008
Hi all,
Could anyone advise me how to make this code to run exactly the same
on both Win32 and Unix ?
==========
Main program:
int ACE_TMAIN (int argc, ACE_TCHAR *argv[])
{
ACE_Process nmproc;
ACE_Process_Options nm_opts;
nm_opts.command_line("testEcho");
ACE_HANDLE pipe[2];
ACE_OS::pipe(pipe);
nm_opts.set_handles(pipe[0]);
ACE_OS::close(pipe[0]);
nmproc.spawn(nm_opts);
ACE_OS::write(pipe[1], "aa\n", 2);
nm_opts.release_handles();
ACE_OS::close(pipe[1]);
return 0;
}
==========
testEcho program:
int main(int argc, char* argv[])
{
printf("TestEcho started\n");
char buf[100];
scanf("%s", buf);
fprintf(stdout, "StdOut:%s\n", buf);
fprintf(stderr, "StdErr:%s\n", buf);
return 0;
}
==========
On Win32 I got the following:
after a call to "ACE_OS::close(pipe[1]);", the testEcho is closed
immidiately and the output is :
TestEcho started
StdOut:aa
StdErr:aa
But when I run this code on Linux, testEcho is never terminated, and
the output is only:
TestEcho started
Please help.
More information about the Ace-users
mailing list