Skip to content
Snippets Groups Projects

[internal #0] fixing f_EPTF_Base_executeShell to use sh/bash/tcsh to start the command

Merged József Gyürüsi requested to merge base_execCmd_fix into master
1 file
+ 21
10
Compare changes
  • Side-by-side
  • Inline
@@ -202,7 +202,7 @@ INTEGER EPTF__CLL__Base__Functions::f__EPTF__Base__executeShell(const CHARSTRING
@@ -202,7 +202,7 @@ INTEGER EPTF__CLL__Base__Functions::f__EPTF__Base__executeShell(const CHARSTRING
}
}
argv[argc++] = (char*)NULL; // no additional args
argv[argc++] = (char*)NULL; // no additional args
*/
*/
argv[0]=strdup("tcsh");
argv[0]=strdup("sh");
argv[1]=strdup("-c");
argv[1]=strdup("-c");
argv[2]=strdup(cmd);
argv[2]=strdup(cmd);
argv[3]=NULL;
argv[3]=NULL;
@@ -212,15 +212,26 @@ INTEGER EPTF__CLL__Base__Functions::f__EPTF__Base__executeShell(const CHARSTRING
@@ -212,15 +212,26 @@ INTEGER EPTF__CLL__Base__Functions::f__EPTF__Base__executeShell(const CHARSTRING
fprintf(stderr,"f_EPTF_Base_executeShell: Failed to start the %s",(const char*)argv[0]);
fprintf(stderr,"f_EPTF_Base_executeShell: Failed to start the %s",(const char*)argv[0]);
fflush(stdout);
fflush(stdout);
fflush(stderr);
fflush(stderr);
/*
}
argv[0]="tcsh";
// this is not reached: if execvp is successful
argv[1]="-c";
// if sh fails, try bash
argv[2]=(char*)(const char*)(CHARSTRING("exit ")+int2str(errno));
argv[0]=strdup("bash");
argv[3]=NULL;
if(execvp(argv[0],argv)< 0) {
// execute
fprintf(stderr,"f_EPTF_Base_executeShell: Failed to start the %s",(const char*)argv[0]);
if(execvp(argv[0],argv) < 0) {
}
fprintf(stderr,"f_EPTF_Base_executeShell: Failed to start the %s",(const char*)argv[0]);
*/
fflush(stdout);
 
fflush(stderr);
 
}
 
// this is not reached: if execvp is successful
 
// if bash fails, try tcsh
 
argv[0]=strdup("tcsh");
 
 
// execute
 
if(execvp(argv[0],argv) < 0) {
 
fprintf(stderr,"f_EPTF_Base_executeShell: Failed to start the %s",(const char*)argv[0]);
 
fflush(stdout);
 
fflush(stderr);
}
}
TTCN_Logger::log(TTCN_Logger::TTCN_DEBUG,"EXECVP FINISHED:");
TTCN_Logger::log(TTCN_Logger::TTCN_DEBUG,"EXECVP FINISHED:");
// this is never reached: 2nd execvp is always successful
// this is never reached: 2nd execvp is always successful
Loading