pelican-eggs / yolks

Docker images designed for use with Pterodactyl's Egg system.
MIT License
90 stars 248 forks source link

Colors in startup command shown when printing command #261

Closed srnyx closed 3 weeks ago

srnyx commented 3 weeks ago

image

Only "No build tool detected (make sure your wrapper is set-up correctly)" should be red here, the big block of red text above it shouldn't be

Occurs due to this line: https://github.com/pelican-eggs/yolks/blob/master/java/entrypoint.sh#L47

Potential fix is by printing $PARSED using echo (assuming excluding the \n at the end of printf will have the echo be on the same line):

printf "\033[1m\033[33mcontainer@pelican~ \033[0m"
echo "$PARSED"

Simple startup command to demonstrate issue:

echo -e "\033[0;31mred text!";
Full startup command being used in screenshot: ```sh # Pull from git if enabled if [[ -d .git && "{{PULL_START}}" == "1" ]]; then GIT_OUTPUT=$(git pull); echo "$GIT_OUTPUT"; fi; # Build application if [[ "{{BUILD_TRIGGER}}" == "Always" || ! -e "{{JAR_FILE}}" || ( "{{BUILD_TRIGGER}}" == "Git changes detected" && "$GIT_OUTPUT" != "Already up to date." ) ]]; then TOOL={{BUILD_TOOL}}; # Automatic (detect) if [[ "$TOOL" == "Automatic" ]]; then if [[ -f gradlew ]]; then TOOL="Gradle"; elif [[ -f mvnw ]]; then TOOL="Maven"; else echo -e "\033[0;31mNo build tool detected (make sure your wrapper is set-up correctly)"; exit 1; fi; fi; if [[ "$TOOL" == "Gradle" ]]; then # Gradle echo "Building with Gradle"; chmod +x gradlew; ./gradlew build; elif [[ "$TOOL" == "Maven" ]]; then # Maven echo "Building with Maven"; ./mvnw clean package; fi; else echo "Skipping build"; fi; # Get JAR file FILE="{{JAR_FILE}}"; if [[ -d "{{JAR_FILE}}" ]]; then # Search given directory FILE=$(find "{{JAR_FILE}}" -name "*.jar" | head -n 1); echo "Found JAR file in {{JAR_FILE}}: $FILE"; fi; # Start application java -Xms128M -Xmx{{SERVER_MEMORY}}M -Dterminal.jline=false -Dterminal.ansi=true -jar "$FILE"; ```