I’m stuck on Stage #IP1.
I’ve tried the following method to execute an external command:
List<String> argsWithCommandName = new ArrayList<>(arguments);
argsWithCommandName.addFirst(commandName);
ProcessBuilder processBuilder = new ProcessBuilder(argsWithCommandName);
try {
Process process = processBuilder.start();
process.waitFor();
String output = inputStreamToString(process.getInputStream());
System.out.println(output);
} catch (Exception e) {
}
Here are my logs:
remote: [compile] Compilation successful.
remote:
remote: Debug = true
remote:
remote: [tester::#IP1] Running tests for Stage #IP1 (Run a program)
remote: [tester::#IP1] [setup] export PATH=/tmp/baz:$PATH
remote: [tester::#IP1] [setup] Available executables:
remote: [tester::#IP1] [setup] - custom_exe_9420
remote: [tester::#IP1] Running ./your_program.sh
remote: [your-program] $ custom_exe_9420 David
remote: [your-program] Program was passed 2 args (including program name).
remote: [your-program] Arg #0 (program name): custom_exe_9420
remote: [your-program] Arg #1: David
remote: [your-program] Program Signature: 3357538634
remote: [tester::#IP1] Expected prompt ("$ ") but received ""
remote: [your-program] $
remote: [tester::#IP1] Assertion failed.
remote: [tester::#IP1] Test failed
I don’t understand why my output would show the proper prompt but the tester says it isn’t there. Maybe it’s something with how Process
handles streams?
Thank you!