From 313844e7a70c4e2b66ed93f703e2d347870bdc6a Mon Sep 17 00:00:00 2001 From: HlmsDeep Date: Tue, 18 Mar 2025 15:54:50 +0000 Subject: [PATCH 1/2] now --- cpp.sh | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/cpp.sh b/cpp.sh index c5387ab..bf5acf9 100644 --- a/cpp.sh +++ b/cpp.sh @@ -22,16 +22,6 @@ if [ $? -ne 0 ]; then cat compile_error.txt exit 1 fi -# Run the compiled program and capture runtime errors -./output_program > output.txt 2> runtime_error.txt - -# Check if there were any runtime errors -if [ $? -ne 0 ]; then - echo -e "Runtime error!\n" - cat runtime_error.txt - exit 1 - -fi # start if [ -f "/usr/src/app/cpp-engine/app/input.txt" ]; then # Run the compiled program with input redirection From 69bdf5283bf369e78acf9d588a23f242cb01d277 Mon Sep 17 00:00:00 2001 From: HlmsDeep Date: Tue, 18 Mar 2025 16:00:24 +0000 Subject: [PATCH 2/2] okay --- cpp.sh | 5 +++++ js.sh | 31 +------------------------------ 2 files changed, 6 insertions(+), 30 deletions(-) diff --git a/cpp.sh b/cpp.sh index bf5acf9..b201965 100644 --- a/cpp.sh +++ b/cpp.sh @@ -15,7 +15,11 @@ if [ "$FILE_EXTENSION" == "c" ]; then clang -o output_program "$CODE_FILE" 2> compile_error.txt elif [ "$FILE_EXTENSION" == "cpp" ]; then clang++ -o output_program "$CODE_FILE" 2> compile_error.txt +else + echo "Invalid language specified! Use 'c' or 'cpp'." + exit 1 fi + # Check if there were any compilation errors if [ $? -ne 0 ]; then echo -e "Compilation failed!\n" @@ -32,6 +36,7 @@ else fi # end if [ $? -ne 0 ]; then + echo -e "Runtime error occurred!\n" cat runtime_error.txt exit 1 fi diff --git a/js.sh b/js.sh index 0da7646..c0cf15d 100644 --- a/js.sh +++ b/js.sh @@ -1,30 +1 @@ -#!/bin/bash - -# Path to the Python file to run -INPUT_REQUIRED=false - -# Check for the flag (modify if using a different flag name) -if [[ "$1" == "inputtrue" ]]; then - INPUT_REQUIRED=true - shift # Remove the flag from the argument list -fi - - -CODE_FILE="/usr/src/app/js-engine/app/index.js" - - -if [[ $INPUT_REQUIRED == true ]]; then - - nodejs $CODE_FILE < /usr/src/app/js-engine/app/input.txt > output.txt 2> runtime_error.txt - -else - nodejs $CODE_FILE > output.txt 2> runtime_error.txt -fi - -if [ $? -ne 0 ]; then - echo "Runtime error!" - cat runtime_error.txt - exit 1 -fi - -cat output.txt +No code provided \ No newline at end of file