libraries/iosrv/client/command_base.cpp
changeset 23 092bcc217d9d
parent 6 96d581d2147d
child 45 534b01198c2d
equal deleted inserted replaced
22:30834c0f3179 23:092bcc217d9d
  1272 
  1272 
  1273 //
  1273 //
  1274 // CCommandBase.
  1274 // CCommandBase.
  1275 //
  1275 //
  1276 
  1276 
  1277 EXPORT_C TInt CCommandBase::RunCommand()
       
  1278 	{
       
  1279 	TRAPD(err, RunCommandL());
       
  1280 	return err;
       
  1281 	}
       
  1282 
       
  1283 EXPORT_C void CCommandBase::RunCommandL()
  1277 EXPORT_C void CCommandBase::RunCommandL()
  1284 	{
  1278 	{
  1285 	RunCommandL(NULL, NULL);
  1279 	RunCommandL(NULL, NULL);
  1286 	}
       
  1287 
       
  1288 EXPORT_C TInt CCommandBase::RunCommand(const TDesC* aCommandLine, CEnvironment* aEnv)
       
  1289 	{
       
  1290 	TRAPD(err, RunCommandL(aCommandLine, aEnv));
       
  1291 	return err;
       
  1292 	}
  1280 	}
  1293 
  1281 
  1294 NONSHARABLE_CLASS(TExitController) : public MCommandBaseObserver
  1282 NONSHARABLE_CLASS(TExitController) : public MCommandBaseObserver
  1295 	{
  1283 	{
  1296 public:
  1284 public:
  1514 		{
  1502 		{
  1515 		CleanupStack::PopAndDestroy((TAny*)commandLine);
  1503 		CleanupStack::PopAndDestroy((TAny*)commandLine);
  1516 		}
  1504 		}
  1517 	}
  1505 	}
  1518 
  1506 
  1519 EXPORT_C TInt CCommandBase::RunCommand(RIoSession& aIoSession, RIoReadHandle& aStdin, RIoWriteHandle& aStdout, RIoWriteHandle& aStderr, const TDesC* aCommandLine, CEnvironment* aEnv)
  1507 void CCommandBase::RunCommand(RIoSession& aIoSession, RIoReadHandle& aStdin, RIoWriteHandle& aStdout, RIoWriteHandle& aStderr, const TDesC* aCommandLine, CEnvironment* aEnv, MCommandBaseObserver* aObserver)
  1520 	{
       
  1521 	TExitController exitController;
       
  1522 	RunCommand(aIoSession, aStdin, aStdout, aStderr, aCommandLine, aEnv, &exitController);
       
  1523 	if (exitController.IsComplete())
       
  1524 		{
       
  1525 		return exitController.CompletionError();
       
  1526 		}
       
  1527 	else
       
  1528 		{
       
  1529 		exitController.WaitForCompletion();
       
  1530 		return exitController.CompletionError();
       
  1531 		}
       
  1532 	}
       
  1533 
       
  1534 EXPORT_C void CCommandBase::RunCommandL(RIoSession& aIoSession, RIoReadHandle& aStdin, RIoWriteHandle& aStdout, RIoWriteHandle& aStderr, const TDesC* aCommandLine, CEnvironment* aEnv)
       
  1535 	{
       
  1536 	User::LeaveIfError(RunCommand(aIoSession, aStdin, aStdout, aStderr, aCommandLine, aEnv));
       
  1537 	}
       
  1538 
       
  1539 EXPORT_C void CCommandBase::RunCommand(RIoSession& aIoSession, RIoReadHandle& aStdin, RIoWriteHandle& aStdout, RIoWriteHandle& aStderr, const TDesC* aCommandLine, CEnvironment* aEnv, MCommandBaseObserver* aObserver)
       
  1540 	{
  1508 	{
  1541 	TRAPD(err, RunCommandL(aIoSession, aStdin, aStdout, aStderr, aCommandLine, aEnv, aObserver));
  1509 	TRAPD(err, RunCommandL(aIoSession, aStdin, aStdout, aStderr, aCommandLine, aEnv, aObserver));
  1542 	if (err)
  1510 	if (err)
  1543 		{
  1511 		{
  1544 		Complete(err);
  1512 		Complete(err);