Program: bbtk
Module: $RCSfile: bbstdExecSystemCommand.cxx,v $
Language: C++
- Date: $Date: 2011/07/12 16:31:00 $
- Version: $Revision: 1.10 $
+ Date: $Date: 2012/10/11 10:49:45 $
+ Version: $Revision: 1.11 $
=========================================================================*/
/* ---------------------------------------------------------------------
int pos1=0,pos2;
pos2 = bbGetInputIn().find(";",pos1);
std::string ccommand;
+ int result = 0;
while (ok)
- {
- if (pos2==-1)
+ {
+ if (pos2==-1)
{
ok=false;
ccommand=bbGetInputIn().substr(pos1,bbGetInputIn().length()-pos1 );
- } else {
+ } else {
ccommand=bbGetInputIn().substr(pos1,pos2-pos1);
}
for (unsigned int i=0 ; i < ccommand.length() ; i++)
{
ccommand[i]=34;
}
- }
-#if defined(_WIN32)
- ccommand="start /b "+ccommand;
-#endif // defined(_WIN32)
- std::cout << "*** Executing system command : '"<<ccommand<<"'"<<std::endl;
- system ( ccommand.c_str() );
- pos1=pos2+1;
- pos2 = bbGetInputIn().find(";",pos2+1);
}
-
+ #if defined(_WIN32)
+ ccommand="start /b "+ccommand;
+ #endif // defined(_WIN32)
+ std::cout << "*** Executing system command : '"<<ccommand<<"'"<<std::endl;
+
+ result = system ( ccommand.c_str() );
+
+ std::cout << "DFGO - ExecSystemCommand::DoProcess result=" << result << std::endl;
+
+ //DFGO - if return code is different than 0 result is equal 1
+
+ if(result)
+ {
+ result = 1;
+ ok = false;
+ }
+ pos1=pos2+1;
+ pos2 = bbGetInputIn().find(";",pos2+1);
+ }
+
+ bbSetOutputReturn(result);
+ //std::cout << "DFGO - ExecSystemCommand::DoProcess result=" << result << std::endl;
+
/* Grrr not works in windows
int i;
char *str = (char*)bbGetInputIn().c_str();