summaryrefslogtreecommitdiff
path: root/cpp/src/IcePack/ActivatorI.cpp
diff options
context:
space:
mode:
authorBenoit Foucher <benoit@zeroc.com>2002-07-17 16:29:35 +0000
committerBenoit Foucher <benoit@zeroc.com>2002-07-17 16:29:35 +0000
commita556e744b44a49bca47aaca909484fb2f7d8fae8 (patch)
tree59e0158c2a550dab07da96b2578a3b9b4e04891d /cpp/src/IcePack/ActivatorI.cpp
parentSlightly better version of Gen.cpp, but still broken. Too tired to fix this (diff)
downloadice-a556e744b44a49bca47aaca909484fb2f7d8fae8.tar.bz2
ice-a556e744b44a49bca47aaca909484fb2f7d8fae8.tar.xz
ice-a556e744b44a49bca47aaca909484fb2f7d8fae8.zip
Removed IceBox two phase initialization. Use Ice.ProgramName in the
standard logger as a prefix. Changed IcePack to pass --Ice.ProgramName to servers.
Diffstat (limited to 'cpp/src/IcePack/ActivatorI.cpp')
-rw-r--r--cpp/src/IcePack/ActivatorI.cpp36
1 files changed, 34 insertions, 2 deletions
diff --git a/cpp/src/IcePack/ActivatorI.cpp b/cpp/src/IcePack/ActivatorI.cpp
index 5db518594b2..0260d459550 100644
--- a/cpp/src/IcePack/ActivatorI.cpp
+++ b/cpp/src/IcePack/ActivatorI.cpp
@@ -136,7 +136,7 @@ IcePack::ActivatorI::activate(const ServerPrx& server, const ::Ice::Current&)
if(pid == 0) // Child process.
{
//
- // Close all filedescriptors, except for standard input,
+ // Close all file descriptors, except for standard input,
// standard output, standard error output, and the write side
// of the newly created pipe.
//
@@ -150,6 +150,34 @@ IcePack::ActivatorI::activate(const ServerPrx& server, const ::Ice::Current&)
}
//
+ // Redirect the standard error output to the write side of the
+ // pipe.
+ //
+ // TODO: This doesn't work well if the server doesn't control
+ // when and how the output is flushed. This can result for
+ // example in printing on character by line... The standard
+ // Ice logger could be changed to flush the stream and not use
+ // automatic flushing.
+ //
+// if(fds[1] != STDERR_FILENO)
+// {
+// if(dup2(fds[1], STDERR_FILENO) != STDERR_FILENO)
+// {
+// //
+// // Send any errors to the parent process, using the write
+// // end of the pipe.
+// //
+// SystemException ex(__FILE__, __LINE__);
+// ex.error = getSystemErrno();
+// ostringstream s;
+// s << "can't redirect stderr to the pipe output";
+// write(fds[1], s.str().c_str(), s.str().length());
+// close(fds[1]);
+// exit(EXIT_FAILURE);
+// }
+// }
+
+ //
// Change working directory.
//
string pwd = desc.pwd;
@@ -184,7 +212,7 @@ IcePack::ActivatorI::activate(const ServerPrx& server, const ::Ice::Current&)
//
// Compute arguments.
//
- int argc = desc.args.size() + _defaultArgs.size() + 2;
+ int argc = desc.args.size() + _defaultArgs.size() + 3;
char** argv = static_cast<char**>(malloc(argc * sizeof(char*)));
argv[0] = strdup(path.c_str());
unsigned int i = 0;
@@ -197,6 +225,10 @@ IcePack::ActivatorI::activate(const ServerPrx& server, const ::Ice::Current&)
{
argv[i + 1] = strdup(q->c_str());
}
+
+ string serverName = "--Ice.ProgramName=" + desc.name;
+ argv[argc - 2] = strdup(serverName.c_str());
+
argv[argc - 1] = 0;
if(execvp(argv[0], argv) == -1)