fix(cli): keep the next step when an error's cause has several lines

A failed docker run with more than one line of output lost its 'floci doctor' hint, and a profile or Compose file that does not parse was reported with the parser's source-location line instead of what to do. Causes are now shown as one line, and docker's own output always gets its next step.

Signed-off-by: Hector Ventura <hectorvent@gmail.com>
This commit is contained in:
Hector Ventura committed 2026-10-11 09:55:23 -05:00
1 parent 97eaa5e820
commit 8c0e06bd0b
12 files changed
+147 -26

No files matched your search

@@ -192,4 +192,19 @@ class MissingProfileTest {
assertThrows(ProfileNotFoundException.class,
() -> cli().parseArgs("start", "--profile", "typo"));
}
/** BL-096: --profile on a file that does not parse says so in two lines: the cause, then what to do. */
@Test
void aProfileThatDoesNotParseIsReportedInTwoLines() throws IOException {
writeProfile("broken", "port: [unterminated\n");
int[] exit = new int[1];
String stderr = captureStderr(() -> cli().execute("status", "--profile", "broken"), exit);
assertEquals(2, exit[0]);
assertEquals(2, stderr.strip().lines().count(), stderr);
assertTrue(stderr.contains("Profile 'broken' is invalid: "), stderr);
assertTrue(stderr.strip().endsWith("and try again."), stderr);
assertFalse(stderr.contains("[Source"), stderr);
}
}