Skip to content

Commit

Permalink
Temp solution for java integration.
Browse files Browse the repository at this point in the history
  • Loading branch information
shashankkumar committed Mar 15, 2012
1 parent 2bfc316 commit 8d5f112
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions Execution.cpp
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -170,13 +170,39 @@ int main(int args, char *argv[]){
if(alarm(TimeLimit)!=0){ if(alarm(TimeLimit)!=0){
ToPipe("IE ERROR Could not set alarm."); ToPipe("IE ERROR Could not set alarm.");
} }
/*
if(strcmp(lang,"java")==0){ if(strcmp(lang,"java")==0){
SetResourceLimitValuesJava(TimeLimit); SetResourceLimitValuesJava(TimeLimit);
if(execl("/usr/bin/java", "/usr/bin/java", "-Xmx4M", "-classpath", InputFile, (char *) NULL) == -1){ if(execl("/usr/bin/java", "/usr/bin/java", "-Xmx4M", "-classpath", InputFile, (char *) NULL) == -1){
fclose(stdout); fclose(stdout);
ToPipe("IE ERROR File not present or some other error."); ToPipe("IE ERROR File not present or some other error.");
} }
} }
*/
if(strcmp(lang,"java")==0){

FILE *fpipe;
char command[100];
sprintf(command, "java Main < %s > %s", TestCaseFile, OutputFile);
char line[256];

if ( !(fpipe = (FILE*)popen(command,"r")) ){
perror("Problems with pipe");
//Logs::WriteLine("Problems with pipe");
}
else{
if ( fgets( line, sizeof line, fpipe)){
;
}
}
pclose(fpipe);
exit(0);
if(execlp("/usr/bin/java", "/usr/bin/java", InputFile, InputFile, (char *) NULL) == -1){
fclose(stdout);
ToPipe("IE ERROR File not present or some other error.");
}


SetResourceLimitValues(TimeLimit); SetResourceLimitValues(TimeLimit);
if(strcmp(lang, "python")==0){ if(strcmp(lang, "python")==0){
strcat(InputFile, ".pyc"); strcat(InputFile, ".pyc");
Expand Down

0 comments on commit 8d5f112

Please sign in to comment.