You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Reduce sh postRun overhead by combining 3 shSync calls into 1
Previously, after each sh command, postRun() made 3 sequential shSync
calls: exit code capture, pwd, and exit code restore. Each shSync blocks
until prompt detection fires, so this added 3 round-trips of overhead
per command.
Combine all three into a single command:
export __qdup_ec=$?; echo "${__qdup_ec}:::$(pwd)"; (exit $__qdup_ec)
This captures exit code, pwd, and restores exit code in one round-trip.
The response is parsed using indexOf to handle the unlikely case of :::
appearing in directory names. If parsing fails (e.g. noisy output from
concurrent processes), retries re-echo the saved variable. If all
retries fail, the run is aborted with a clear error message rather than
continuing in an unknown state.
@@ -197,16 +232,16 @@ public void postRun(String output,Context context){
197
232
context.error("aborting run due to unexpected characters in exit code ["+response+"] The prompt may have changed\n host: "+context.getShell().getHost()+"\n command: "+ this +(stack.length()>0?"\nstack:"+stack.toString():""));
198
233
}
199
234
200
-
201
235
context.abort(false);
202
236
}
203
237
}
204
238
}else{
205
-
//duplicate getting toLog to avoid the overhead if not needed
0 commit comments