0

I am writing a command-line Ruby gem for CraftBukkit (of Minecraft fame).

So, CraftBukkit's .jar file functions as any command-line server interface should: it accepts user input and sends it to the server when the admin presses enter, while displaying a live feed of server events.

Executed in the command-line directly, then,

java -Xmx1024M -Xms1024M -jar craftbukkit.jar

functions perfectly. I need to execute that same command within my Ruby gem and accept user input in the same way. I am currently using %x{} like so:

%x{java -Xmx1024M -Xms1024M -jar craftbukkit.jar}

This functions reasonably well, as it displays output as it should and executes commands typed into the command line window. It does not, however, show user input as it is typed.

I need to fix this. What Ruby commands/frameworks can I use to make the java command function perfectly?

If possible, I would also like to be able to parse the output.

I am using Clamp to parse command line arguments, if that matters.

1 Answer 1

3

Does

system "java -Xmx1024M -Xms1024M -jar craftbukkit.jar"

do what you wanted? It should at least display the input and output. Or did you want to parse the output from within Ruby?

Sign up to request clarification or add additional context in comments.

1 Comment

That works beautifully! It serves my purposes for now, but are there alternatives that would let me parse it?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.