diff --git a/std-script/compile b/std-script/compile --- a/std-script/compile +++ b/std-script/compile @@ -93,16 +93,16 @@ case params[:prog_lang] when "c" - command = "#{C_COMPILER} #{params[:source_file]} -o #{params[:output_file]} #{C_OPTIONS} 2> #{params[:message_file]}" - system(command) + command = "#{C_COMPILER} #{params[:source_file]} -o #{params[:output_file]} #{C_OPTIONS}" + system(command, err: params[:message_file]) when "c++" - command = "#{CPLUSPLUS_COMPILER} #{params[:source_file]} -o #{params[:output_file]} #{CPLUSPLUS_OPTIONS} 2> #{params[:message_file]}" - system(command) + command = "#{CPLUSPLUS_COMPILER} #{params[:source_file]} -o #{params[:output_file]} #{CPLUSPLUS_OPTIONS}" + system(command, err: params[:message_file]) when "pas" - command = "#{PASCAL_COMPILER} #{params[:source_file]} -ooutpas #{PASCAL_OPTIONS} > #{params[:message_file]}" - system(command) + command = "#{PASCAL_COMPILER} #{params[:source_file]} -ooutpas #{PASCAL_OPTIONS}" + system(command,out: params[:message_file]) FileUtils.mv("output", params[:output_file]) when "java" @@ -122,8 +122,8 @@ end end #system("cp #{params[:source_file]} #{classname}.java") - command = "#{JAVA_COMPILER} #{classname}.java 2> #{params[:message_file]}" - system(command) + command = "#{JAVA_COMPILER} #{classname}.java" + system(command, err: params[:message_file]) if File.exists?(classname + ".class") File.open(params[:output_file],"w") {|file| file.write("#{classname}")} end @@ -132,8 +132,8 @@ end when "ruby" - command = "#{RUBY_INTERPRETER} -c #{params[:source_file]} 2> #{params[:message_file]}" - if system(command) + command = "#{RUBY_INTERPRETER} -c #{params[:source_file]}" + if system(command, err: params[:message_file]) File.open(params[:output_file],"w") do |out_file| out_file.puts "#!#{RUBY_INTERPRETER}" File.open(params[:source_file],"r").each do |line| @@ -144,8 +144,8 @@ end when "python" - command = "#{PYTHON_CHECKER} #{params[:source_file]} > #{params[:message_file]}" - if system(command) + command = "#{PYTHON_CHECKER} #{params[:source_file]}" + if system(command, out: params[:message_file]) #compile to python bytecode command = "#{PYTHON_INTERPRETER} -m py_compile #{params[:source_file]}" puts "compile: #{command}" @@ -160,8 +160,8 @@ end when "php" - command = "#{PHP_INTERPRETER} #{PHP_OPTIONS} #{params[:source_file]} 2> #{params[:message_file]}" - if system(command) + command = "#{PHP_INTERPRETER} #{PHP_OPTIONS} #{params[:source_file]}" + if system(command, err: params[:message_file]) File.open(params[:output_file],"w") do |out_file| out_file.puts "#!#{PHP_INTERPRETER}" File.open(params[:source_file],"r").each do |line| diff --git a/std-script/run b/std-script/run --- a/std-script/run +++ b/std-script/run @@ -104,22 +104,22 @@ classname = line end #for java, we cannot really check the memory limit... - run_command = "#{problem_home}/script/box -a 3 -f -T -t #{time_limit} #{JAVA_OPTION} -i #{input_file_name} -o output.txt /usr/bin/java #{classname} 2>run_result" + run_command = "#{problem_home}/script/box -a 3 -f -T -t #{time_limit} #{JAVA_OPTION} -i #{input_file_name} -o output.txt /usr/bin/java #{classname} " when "ruby" - run_command = "#{problem_home}/script/box -a 2 -f -T -t #{time_limit*=2} -m #{mem_limit} #{RUBY_OPTION} -i #{input_file_name} -o output.txt /usr/bin/ruby #{program_name} 2>run_result" + run_command = "#{problem_home}/script/box -a 2 -f -T -t #{time_limit*=2} -m #{mem_limit} #{RUBY_OPTION} -i #{input_file_name} -o output.txt /usr/bin/ruby #{program_name} " when "python" - run_command = "#{problem_home}/script/box -a 2 -f -T -t #{time_limit*=2} -m #{mem_limit} #{PYTHON_OPTION} -i #{input_file_name} -o output.txt /usr/bin/python #{program_name} 2>run_result" + run_command = "#{problem_home}/script/box -a 2 -f -T -t #{time_limit*=2} -m #{mem_limit} #{PYTHON_OPTION} -i #{input_file_name} -o output.txt /usr/bin/python #{program_name} " when "php" - run_command = "#{problem_home}/script/box -a 2 -f -T -t #{time_limit*=2} #{PHP_OPTION} -i #{input_file_name} -o output.txt /usr/bin/php #{program_name} 2>run_result" + run_command = "#{problem_home}/script/box -a 2 -f -T -t #{time_limit*=2} #{PHP_OPTION} -i #{input_file_name} -o output.txt /usr/bin/php #{program_name} " else # for c++, pascal, we do the normal checking - run_command = "#{problem_home}/script/box -a 2 -f -T -t #{time_limit} -m #{mem_limit} -i #{input_file_name} -o output.txt #{program_name} 2>run_result" + run_command = "#{problem_home}/script/box -a 2 -f -T -t #{time_limit} -m #{mem_limit} -i #{input_file_name} -o output.txt #{program_name} " end log "Running test #{test_num}..." log run_command log -system(run_command) +system(run_command,err: 'run_result') # Restore PROBLEM_HOME ENV['PROBLEM_HOME'] = problem_home