本文整理汇总了C++中ACE_Process_Options::inherit_environment方法的典型用法代码示例。如果您正苦于以下问题:C++ ACE_Process_Options::inherit_environment方法的具体用法?C++ ACE_Process_Options::inherit_environment怎么用?C++ ACE_Process_Options::inherit_environment使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ACE_Process_Options
的用法示例。
在下文中一共展示了ACE_Process_Options::inherit_environment方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
//.........这里部分代码省略.........
// Save STD file descriptors and redirect
if (options.get_stdin () != ACE_INVALID_HANDLE) {
if ((saved_stdin = ACE_OS::dup (ACE_STDIN)) == -1 && errno != EBADF)
ACE_OS::exit (errno);
if (ACE_OS::dup2 (options.get_stdin (), ACE_STDIN) == -1)
ACE_OS::exit (errno);
}
if (options.get_stdout () != ACE_INVALID_HANDLE) {
if ((saved_stdout = ACE_OS::dup (ACE_STDOUT)) == -1 && errno != EBADF)
ACE_OS::exit (errno);
if (ACE_OS::dup2 (options.get_stdout (), ACE_STDOUT) == -1)
ACE_OS::exit (errno);
}
if (options.get_stderr () != ACE_INVALID_HANDLE) {
if ((saved_stderr = ACE_OS::dup (ACE_STDERR)) == -1 && errno != EBADF)
ACE_OS::exit (errno);
if (ACE_OS::dup2 (options.get_stderr (), ACE_STDERR) == -1)
ACE_OS::exit (errno);
}
// Wide-char builds need narrow-char strings for commandline and
// environment variables.
# if defined (ACE_USES_WCHAR)
wchar_t * const *wargv = options.command_line_argv ();
size_t vcount, i;
for (vcount = 0; wargv[vcount] != 0; ++vcount)
;
char **procargv = new char *[vcount + 1]; // Need 0 at the end
procargv[vcount] = 0;
for (i = 0; i < vcount; ++i)
procargv[i] = ACE_Wide_To_Ascii::convert (wargv[i]);
char **procenv = 0;
if (options.inherit_environment ())
{
wargv = options.env_argv ();
for (vcount = 0; wargv[vcount] != 0; ++vcount)
;
procenv = new char *[vcount + 1]; // Need 0 at the end
procenv[vcount] = 0;
for (i = 0; i < vcount; ++i)
procenv[i] = ACE_Wide_To_Ascii::convert (wargv[i]);
}
# else
const char **procargv = const_cast<const char**> (options.command_line_argv ());
const char **procenv = const_cast<const char**> (options.env_argv ());
# endif /* ACE_USES_WCHAR */
this->child_id_ = ::rtpSpawn (procargv[0],
procargv,
procenv,
200, // priority
0x10000, // uStackSize
0, // options
VX_FP_TASK); // taskOptions
int my_errno_ = errno;
if (this->child_id_ == ERROR) {
// something went wrong
this->child_id_ = ACE_INVALID_PID;
}
# if defined (ACE_USES_WCHAR)
if (procenv)
delete procenv;
# endif /* ACE_USES_WCHAR */