refactor: return only command when no interpreter and no beforeCommands (#7452)

This commit is contained in:
Mathieu Gabelle
2025-02-18 18:59:04 +01:00
committed by GitHub
parent 666f8a7ad9
commit e0eaf675b2

View File

@@ -172,12 +172,15 @@ public class CommandsWrapper implements TaskCommands {
List<String> renderedBeforeCommands = this.renderCommands(runContext, beforeCommands);
List<String> renderedInterpreter = this.renderCommands(runContext, interpreter);
List<String> finalCommands = ScriptService.scriptCommands(
renderedInterpreter,
renderedBeforeCommands,
renderedCommands,
Optional.ofNullable(targetOS).orElse(TargetOS.AUTO)
);
List<String> finalCommands = renderedBeforeCommands.isEmpty() && renderedInterpreter.isEmpty() ?
renderedCommands :
ScriptService.scriptCommands(
renderedInterpreter,
renderedBeforeCommands,
renderedCommands,
Optional.ofNullable(targetOS).orElse(TargetOS.AUTO)
);
this.commands = Property.of(finalCommands);
ScriptOutput.ScriptOutputBuilder scriptOutputBuilder = ScriptOutput.builder()