コード例 #1
0
ファイル: Main.cpp プロジェクト: ClxS/fastbuild
	int LaunchSubProcess( const AString & args )
	{
		// try to make a copy of our exe
		AStackString<> exeName;
		Env::GetExePath( exeName );
		AStackString<> exeNameCopy( exeName );
		exeNameCopy += ".copy";
		Timer t;
		while ( FileIO::FileCopy( exeName.Get(), exeNameCopy.Get() ) == false )
		{
			if ( t.GetElapsed() > 5.0f )
			{
				AStackString<> msg;
				msg.Format( "Failed to make sub-process copy - error: %u (0x%x)\n\nSrc: %s\nDst: %s\n", Env::GetLastErr(), Env::GetLastErr(), exeName.Get(), exeNameCopy.Get() );
				ShowMsgBox( msg.Get() );
				return -2;
			}
			Thread::Sleep( 100 );
		}
	
		AStackString<> argsCopy( args );
		argsCopy += " -subprocess";
	
		// allow subprocess to access the mutex
		g_OneProcessMutex.Unlock();
	
		Process p;
	    #if defined( __WINDOWS__ )
	        p.DisableHandleRedirection(); // TODO:MAC TODO:LINUX is this needed?
	    #endif
		p.Spawn( exeNameCopy.Get(), argsCopy.Get(), nullptr, nullptr );
		p.Detach();
	
		return 0;
	}
コード例 #2
0
ファイル: Worker.cpp プロジェクト: jujis008/fastbuild
// DESTRUCTOR
//------------------------------------------------------------------------------
Worker::~Worker()
{
	FDELETE m_NetworkStartupHelper;
	FDELETE m_ConnectionPool;
	FDELETE m_MainWindow;
	FDELETE m_JobQueueRemote;
	FDELETE m_WorkerSettings;

	if ( m_RestartNeeded )
	{
		Process p;
		p.Spawn( m_BaseExeName.Get(), 
			     m_BaseArgs.Get(), 
				 nullptr,	// default workingDir
				 nullptr ); // default env
		p.Detach();
	}
}