diff --git a/grader_id b/grader_id --- a/grader_id +++ b/grader_id @@ -1,5 +1,7 @@ #!/usr/bin/ruby +require 'fileutils' + def talk(str) if TALKATIVE puts str @@ -85,5 +87,5 @@ RAILS_ENV = 'development' require RAILS_APP_DIR + '/config/environment' -current_dir = `pwd` +current_dir = FileUtils.pwd grade(ARGV[0].to_i) diff --git a/lib/engine.rb b/lib/engine.rb --- a/lib/engine.rb +++ b/lib/engine.rb @@ -31,7 +31,7 @@ # takes a submission, asks room_maker to produce grading directories, # calls grader scripts, and asks reporter to save the result def grade(submission) - current_dir = `pwd`.chomp + current_dir = FileUtils.pwd user = submission.user problem = submission.problem diff --git a/std-script/judge b/std-script/judge --- a/std-script/judge +++ b/std-script/judge @@ -66,7 +66,7 @@ log "Making test result and sandbox directories..." -current_dir = `pwd` +current_dir = FileUtils.pwd current_dir.strip! if ARGV.length >= 3 @@ -99,7 +99,7 @@ exit(127) end execute("#{problem_home}/script/compile #{language} #{source_file}", "Compilation error!") -compile_message = `cat compiler_message` +compile_message = open("compiler_message").read compile_message.strip! call_and_log("Cannot move the compiler message to #{test_result_dir}.") { FileUtils.mv("compiler_message", test_result_dir) diff --git a/std-script/run b/std-script/run --- a/std-script/run +++ b/std-script/run @@ -111,7 +111,7 @@ result_file.write run_stat.strip result_file.write "\n" result_file.close - `rm run_result` + FileUtils.rm "run_result" # `rm output.txt` --- keep the output comment_file.write comment