From 9fb86f86954e7739ea93882727314dd42a244643 Mon Sep 17 00:00:00 2001 From: Will Reichert Date: Fri, 22 Mar 2024 22:31:11 -0400 Subject: [PATCH] add exit-code retry and rename to exit_code in profiles --- src/main/java/io/hyperfoil/tools/qdup/cmd/impl/Sh.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/io/hyperfoil/tools/qdup/cmd/impl/Sh.java b/src/main/java/io/hyperfoil/tools/qdup/cmd/impl/Sh.java index a6b9d79c..cf0b22da 100644 --- a/src/main/java/io/hyperfoil/tools/qdup/cmd/impl/Sh.java +++ b/src/main/java/io/hyperfoil/tools/qdup/cmd/impl/Sh.java @@ -117,9 +117,13 @@ public void postRun(String output,Context context){ context.getShell().getHost().isShell()) { String response = context.getShell().shSync("export __qdup_ec=$?; echo $__qdup_ec;"); + // ensure the output does not contain characters from other processes + while(!response.matches("\\d+")){ + response = context.getShell().shSync("echo $__qdup_ec;"); + } String pwd = context.getShell().shSync("pwd"); context.setCwd(pwd); - context.getCommandTimer().getJson().set("response",response); + context.getCommandTimer().getJson().set("exit_code",response); context.getCommandTimer().getJson().set("cwd",pwd); context.getShell().shSync("(exit $__qdup_ec);"); context.getShell().flushAndResetBuffer();