tracesrv/tracecore/btrace_handler/test/TEF/te_tracecore/src/te_processcreator.cpp
changeset 56 aa2539c91954
equal deleted inserted replaced
54:a151135b0cf9 56:aa2539c91954
       
     1 // Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 
       
    17 
       
    18 /**
       
    19  @file
       
    20  @internalTechnology
       
    21 */
       
    22 #include "te_processcreator.h"
       
    23 
       
    24 
       
    25 TProcessCreatorResults CProcessCreator::StartProgram(const TDesC& aProgramName, 
       
    26 													 const TDesC& aCommandLineArgs, 
       
    27 													 TBool aWaitForCompletion)
       
    28     {
       
    29     RProcess process;
       
    30 	TProcessCreatorResults res;
       
    31 	res.iExitType = EExitPending;
       
    32 	res.iCode = process.Create(aProgramName, aCommandLineArgs);
       
    33 	if(res.iCode == KErrNone)
       
    34 		{
       
    35 		if(aWaitForCompletion)
       
    36 		    {
       
    37             TRequestStatus status = KRequestPending;
       
    38 			process.Logon(status);
       
    39 			process.Resume();
       
    40 			User::WaitForRequest(status);
       
    41             if(status.Int() == KErrNone)
       
    42                 {
       
    43                 res.iCode = process.ExitReason();
       
    44                 res.iExitType = process.ExitType();
       
    45                 res.iDesc.Copy(process.ExitCategory());
       
    46                 }
       
    47             else
       
    48                 {
       
    49                 res.iCode = status.Int();
       
    50                 }
       
    51             }
       
    52 		else
       
    53 		    {
       
    54             process.Resume();
       
    55 		    }
       
    56 		}
       
    57 	process.Close();
       
    58 	
       
    59 	return res;
       
    60     }
       
    61