本文整理汇总了C++中ProcessLaunchInfo::AppendCloseFileAction方法的典型用法代码示例。如果您正苦于以下问题:C++ ProcessLaunchInfo::AppendCloseFileAction方法的具体用法?C++ ProcessLaunchInfo::AppendCloseFileAction怎么用?C++ ProcessLaunchInfo::AppendCloseFileAction使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ProcessLaunchInfo
的用法示例。
在下文中一共展示了ProcessLaunchInfo::AppendCloseFileAction方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getenv
//.........这里部分代码省略.........
// Create a temporary file to get the stdout/stderr and redirect the
// output of the command into this file. We will later read this file
// if all goes well and fill the data into "command_output_ptr"
if (in_port == 0)
{
// Binding to port zero, we need to figure out what port it ends up
// using using a named pipe...
error = port_pipe.CreateWithUniqueName("debugserver-named-pipe", false, named_pipe_path);
if (error.Success())
{
debugserver_args.AppendArgument("--named-pipe");
debugserver_args.AppendArgument(named_pipe_path.c_str());
}
else
{
if (log)
log->Printf("GDBRemoteCommunication::%s() "
"named pipe creation failed: %s",
__FUNCTION__, error.AsCString());
// let's try an unnamed pipe
error = port_pipe.CreateNew(true);
if (error.Fail())
{
if (log)
log->Printf("GDBRemoteCommunication::%s() "
"unnamed pipe creation failed: %s",
__FUNCTION__, error.AsCString());
return error;
}
int write_fd = port_pipe.GetWriteFileDescriptor();
debugserver_args.AppendArgument("--pipe");
debugserver_args.AppendArgument(std::to_string(write_fd).c_str());
launch_info.AppendCloseFileAction(port_pipe.GetReadFileDescriptor());
}
}
else
{
listen = true;
}
}
else
{
// No host and port given, so lets listen on our end and make the debugserver
// connect to us..
error = StartListenThread ("127.0.0.1", 0);
if (error.Fail())
return error;
ConnectionFileDescriptor *connection = (ConnectionFileDescriptor *)GetConnection ();
// Wait for 10 seconds to resolve the bound port
out_port = connection->GetListeningPort(10);
if (out_port > 0)
{
char port_cstr[32];
snprintf(port_cstr, sizeof(port_cstr), "127.0.0.1:%i", out_port);
// Send the host and port down that debugserver and specify an option
// so that it connects back to the port we are listening to in this process
debugserver_args.AppendArgument("--reverse-connect");
debugserver_args.AppendArgument(port_cstr);
}
else
{
error.SetErrorString ("failed to bind to port 0 on 127.0.0.1");
return error;
}