if (argc!=2)
{
std::cout << "usage : bbPlugPackage <path_to_package>" << std::endl;
- return 0;
+ return (int)1;
}
std::string path(argv[1]);
if ( ! Utilities::FileExists( fname ) )
{
- std::cout << "* ERROR : The directory '"<<path<<"' does not contain a 'bbtkPackage' file"
- << std::endl;
- return 1;
+ std::cout << "* ERROR : The directory '"<<path<<"' does not contain a 'bbtkPackage' file" << std::endl;
+ return (int)2;
}
std::ifstream f;
<< command << "'" << std::endl;
//return 1; Feature #1676 - DFGO
}
- return 0;
+ return (int)0;
}
//==========================================================================
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();
Program: bbtk
Module: $RCSfile: bbstdExecSystemCommand.h,v $
Language: C++
- Date: $Date: 2009/05/14 14:43:38 $
- Version: $Revision: 1.7 $
+ Date: $Date: 2012/10/11 10:49:45 $
+ Version: $Revision: 1.8 $
=========================================================================*/
/* ---------------------------------------------------------------------
public:
BBTK_BLACK_BOX_INTERFACE(ExecSystemCommand,bbtk::AtomicBlackBox);
BBTK_DECLARE_INPUT(In,std::string)
+ BBTK_DECLARE_OUTPUT(Return,int);
BBTK_PROCESS(DoProcess);
void DoProcess();
};
BBTK_NAME("ExecSystemCommand");
BBTK_AUTHOR("eduardo.davila@creatis.insa-lyon.fr");
BBTK_DESCRIPTION("Executes system (O.S.) commands");
- BBTK_INPUT(ExecSystemCommand,In,"system (O.S.) commands separated by ';' , use '' to indicate strings ex. help 'graph' ",std::string,"");
+ BBTK_INPUT(ExecSystemCommand,In,"system (O.S.) commands separated by ';' , use '' to indicate strings ex. help 'graph' ",std::string,"");
+ BBTK_OUTPUT(ExecSystemCommand,Return,"result (0 if no error or error number of the first error",int,"");
BBTK_END_DESCRIBE_BLACK_BOX(ExecSystemCommand);
} // EO namespace bbstd
APP_START
CATEGORY:Core Script
DESCRIPTION:Plug Package script
-AUTHOR:Daniel Gonzalez
+AUTHOR:Daniel F Gonzalez
COMPLEXBOX:FALSE
BOXES:7
BOX
include wx
include std
-author "Daniel Gonzalez"
+author "Daniel F Gonzalez"
description "Plug Package script"
category "Core Script"