Skip to content

Fix Stop command quotes #107

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

GrayR0ot
Copy link
Contributor

@GrayR0ot GrayR0ot commented Apr 2, 2025

Hello,

After the recent change which was the removal of the args.StopCommand replace it seems the command is now sent between quotes.

Here is the bug it produces:

image

The command that the server handle is not correctly parsed.

@itzg
Copy link
Owner

itzg commented Apr 3, 2025

I'm wondering though how does it end up with quotes around it?

@itzg
Copy link
Owner

itzg commented Apr 3, 2025

I just now tested with

--stop-command "stop 120"

and

--stop-command="stop 120"

and in both cases the args.StopCommand didn't have extra quotes.

@GrayR0ot
Copy link
Contributor Author

GrayR0ot commented Apr 3, 2025

On my side I'm using it that way in Dockerfile:

CMD ["mc-server-runner", "--stop-command", "\"stop 180\"", \
    "java", \
    "-Xms2G", \
    "-Xmx2G", \
    "-XX:+UseG1GC", \
    "-XX:+ParallelRefProcEnabled", \
    "-XX:MaxGCPauseMillis=200", \
    "-XX:+UnlockExperimentalVMOptions", \
    "-XX:+DisableExplicitGC", \
    "-XX:+AlwaysPreTouch", \
    "-XX:G1NewSizePercent=30", \
    "-XX:G1MaxNewSizePercent=40", \
    "-XX:G1HeapRegionSize=8M", \
    "-XX:G1ReservePercent=20", \
    "-XX:G1HeapWastePercent=5", \
    "-XX:G1MixedGCCountTarget=4", \
    "-XX:InitiatingHeapOccupancyPercent=15", \
    "-XX:G1MixedGCLiveThresholdPercent=90", \
    "-XX:G1RSetUpdatingPauseTimePercent=5", \
    "-XX:SurvivorRatio=32", \
    "-XX:+PerfDisableSharedMem", \
    "-XX:MaxTenuringThreshold=1", \
    "-Dusing.aikars.flags=https://mcflags.emc.gs", \
    "-Daikars.new.flags=true", \
    "-jar", "paper.jar"]

Or do you pass the stop command as the latest arg?

@itzg
Copy link
Owner

itzg commented Apr 3, 2025

There's your extra quotes

"\"stop 180\""

Just use

"stop 180"

Since CMD will pass each element as a distinct argument to the Linux process call.

You might be getting confused about shell and exec forms. You're using exec form of CMD where the quoting you normally need from a shell is not needed

https://docs.docker.com/reference/dockerfile/#shell-and-exec-form

@GrayR0ot
Copy link
Contributor Author

GrayR0ot commented Apr 3, 2025

Oh damn, I didn't knew that ty

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants