Correction bug

This commit is contained in:
Moncef STITI 2025-03-16 17:00:22 +01:00
parent 072dc2a119
commit c4397daad8
2 changed files with 276 additions and 226 deletions

File diff suppressed because it is too large Load Diff

@ -114,6 +114,8 @@ public class CommandExecutor {
if (ruleNeedsUpdate) {
try {
if(!isCircular && !silent){
String displayCommand = BakefileParser.expandVariables(command);
// Afficher les lignes formatées avec traitement spécial pour les continuations
if (displayLines != null && !displayLines.isEmpty()) {
boolean isFirstLine = true;
@ -121,26 +123,34 @@ public class CommandExecutor {
for (String line : displayLines) {
if (isFirstLine) {
// Pour la première ligne, toujours supprimer l'indentation
String expandedLine = line;
if (line.startsWith("\t")) {
System.out.println(line.substring(1));
String content = line.substring(1);
expandedLine = "\t" + BakefileParser.expandVariables(content);
System.out.println(expandedLine.substring(1));
} else {
System.out.println(line);
expandedLine = BakefileParser.expandVariables(line);
System.out.println(expandedLine);
}
isFirstLine = false;
} else {
// Pour les lignes suivantes d'une continuation, conserver l'indentation
System.out.println(line);
String expandedLine = BakefileParser.expandVariables(line);
System.out.println(expandedLine);
}
}
} else {
// Cas d'une commande simple (une seule ligne)
if (command.startsWith("\t")) {
System.out.println(command.substring(1));
if (displayCommand.startsWith("\t")) {
System.out.println(displayCommand.substring(1));
} else {
System.out.println(command);
System.out.println(displayCommand);
}
}
}
actualCommand = BakefileParser.expandVariables(actualCommand);
if (debug) System.out.println("Debug: Executing " + actualCommand);
ProcessBuilder pb = new ProcessBuilder("sh", "-c", actualCommand);
pb.inheritIO();