]>
git.proxmox.com Git - ceph.git/blob - ceph/src/jaegertracing/thrift/contrib/transport-sample/ThriftCommon.cpp
1 // ThriftCommon.cpp : Common functions for sample Thrift client and server
4 #include "ThriftCommon.h"
8 //----------------------------------------------------------------------------
9 //Launch child process and pass R/W anonymous pipe handles on cmd line.
10 //This is a simple example and does not include elevation or other
13 bool LaunchAnonPipeChild(std::string app
, boost::shared_ptr
<TServerTransport
> transport
)
16 PROCESS_INFORMATION pi
;
18 GetStartupInfoA(&si
); //set startupinfo for the spawned process
19 char handles
[MAX_PATH
]; //Stores pipe handles converted to text
21 sprintf(handles
, "%s %d %d", app
.c_str(),
22 (int)boost::shared_dynamic_cast
<TPipeServer
>(transport
)->getClientRdPipeHandle(),
23 (int)boost::shared_dynamic_cast
<TPipeServer
>(transport
)->getClientWrtPipeHandle());
25 //spawn the child process
26 if (!CreateProcessA(NULL
, handles
, NULL
,NULL
,TRUE
,0,NULL
,NULL
,&si
,&pi
))
28 GlobalOutput
.perror("TPipeServer CreateProcess failed, GLE=", GetLastError());
32 CloseHandle(pi
.hThread
);
33 CloseHandle(pi
.hProcess
);