Skip to content

Commit 4d17b2a

Browse files
committed
ensure unshare user has a valid name
1 parent 795ef29 commit 4d17b2a

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/main/java/io/zonky/test/db/postgres/util/LinuxUtils.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,12 @@ private static boolean unshareAvailable() {
115115

116116
try (BufferedReader outputReader = new BufferedReader(new InputStreamReader(process.getInputStream(), UTF_8))) {
117117
if (process.exitValue() == 0 && !"0".equals(outputReader.readLine())) {
118-
return true;
118+
builder.command("unshare", "-U", "id", "-un");
119+
Process nameprocess = builder.start();
120+
nameprocess.waitFor();
121+
if (nameprocess.exitValue() == 0) {
122+
return true;
123+
}
119124
}
120125
}
121126

0 commit comments

Comments
 (0)