Description:
fix java compiler and runner
box does not stop on time because we let box run the script, not the java itself
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
r158:19e4c7e30be4 - - 2 files changed: 12 inserted, 4 deleted
@@ -116,8 +116,10 | |||||
|
116 | command = "#{JAVA_COMPILER} #{classname}.java 2> #{params[:message_file]}" |
|
116 | command = "#{JAVA_COMPILER} #{classname}.java 2> #{params[:message_file]}" |
|
117 | system(command) |
|
117 | system(command) |
|
118 | if File.exists?(classname + ".class") |
|
118 | if File.exists?(classname + ".class") |
|
119 |
- File.open(params[:output_file],"w") {|file| file.write("# |
|
119 | + File.open(params[:output_file],"w") {|file| file.write("#{classname}")} |
|
120 | - File.chmod(0755, params[:output_file]) |
|
120 | + end |
|
|
121 | + if classname == 'DUMMY' | ||
|
|
122 | + File.open(params[:message_file],"w") {|file| file.write("Cannot find any public class in the source code\n")} | ||
|
121 | end |
|
123 | end |
|
122 |
|
124 | ||
|
123 | when "ruby" |
|
125 | when "ruby" |
@@ -91,8 +91,14 | |||||
|
91 |
|
91 | ||
|
92 | case language |
|
92 | case language |
|
93 | when "java" |
|
93 | when "java" |
|
94 | - # for java, we have to add additional systemcall and we don't check the mem limit (dunno how to fix...) |
|
94 | + |
|
95 | - run_command = "#{problem_home}/script/box -T -t #{time_limit} -s getppid -s clone -s wait4 -p /usr/bin/ -p ./ -i #{input_file_name} -o output.txt #{program_name} 2>run_result" |
|
95 | + # for java, extract the classname |
|
|
96 | + # wne have to add additional systemcall and we don't check the mem limit (dunno how to fix...) | ||
|
|
97 | + classname = 'DUMMY' | ||
|
|
98 | + File.open(program_name,"r").each do |line| | ||
|
|
99 | + classname = line | ||
|
|
100 | + end | ||
|
|
101 | + run_command = "#{problem_home}/script/box -T -t #{time_limit} -s getppid -s clone -s wait4 -p /usr/bin/ -p ./ -i #{input_file_name} -o output.txt /usr/bin/java #{classname} 2>run_result" | ||
|
96 | when "ruby" |
|
102 | when "ruby" |
|
97 | run_command = "#{problem_home}/script/box -T -t #{time_limit} -s getppid -s wait4 -s clone -s set_robust_list -s futex -s sigaltstack -p /dev/urandom -p ./ -p /home/dae/.rvm/rubies/ruby-1.9.2-p320/ -p #{problem_home}/ -i #{input_file_name} -o output.txt #{program_name} 2>run_result" |
|
103 | run_command = "#{problem_home}/script/box -T -t #{time_limit} -s getppid -s wait4 -s clone -s set_robust_list -s futex -s sigaltstack -p /dev/urandom -p ./ -p /home/dae/.rvm/rubies/ruby-1.9.2-p320/ -p #{problem_home}/ -i #{input_file_name} -o output.txt #{program_name} 2>run_result" |
|
98 | when "python" |
|
104 | when "python" |
You need to be logged in to leave comments.
Login now