diff --git a/judge/judgedaemon.main.php b/judge/judgedaemon.main.php index f38b2013733..2f530aeac43 100644 --- a/judge/judgedaemon.main.php +++ b/judge/judgedaemon.main.php @@ -418,13 +418,15 @@ function fetch_executable_internal( // no main class detection here $buildscript .= "echo 'COMPARE_DIR=\$(dirname \"\$0\")' >> run\n"; $mainClass = basename($unescapedSource, '.java'); - $buildscript .= "echo 'java -cp \"\$COMPARE_DIR\" $mainClass \"\\\$@\"' >> run\n"; + // Note: since the $@ is within single quotes, we do not need to double escape it. + $buildscript .= "echo 'java -cp \"\$COMPARE_DIR\" $mainClass \"\$@\"' >> run\n"; $buildscript .= "chmod +x run\n"; break; case 'py': $buildscript .= "echo '#!/bin/sh' > run\n"; $buildscript .= "echo 'COMPARE_DIR=\$(dirname \"\$0\")' >> run\n"; - $buildscript .= "echo 'python3 \$COMPARE_DIR/$source' \"\\\$@\" >> run\n"; + // Note: since the $@ is within single quotes, we do not need to double escape it. + $buildscript .= "echo 'python3 \$COMPARE_DIR/$source' \"\$@\" >> run\n"; $buildscript .= "chmod +x run\n"; break; }