Correction de bug #2
This commit is contained in:
@@ -2,6 +2,7 @@ package fr.monlouyan.bakefile;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Exécuteur des commandes définies dans les règles.
|
||||
@@ -70,7 +71,13 @@ public class CommandExecutor {
|
||||
return; // On ne fait rien mais on ne montre pas de message
|
||||
}
|
||||
|
||||
for (String command : rule.getCommands()) {
|
||||
List<String> executableCommands = rule.getCommands();
|
||||
List<List<String>> displayCommands = rule.getDisplayCommands();
|
||||
|
||||
for (int i = 0; i < executableCommands.size(); i++) {
|
||||
String command = executableCommands.get(i);
|
||||
List<String> displayLines = (i < displayCommands.size()) ? displayCommands.get(i) : null;
|
||||
|
||||
// Vérifier si la commande commence par @ (ne pas afficher la commande)
|
||||
boolean silent = command.startsWith("@");
|
||||
// Enlever le @ si présent pour exécuter la commande correctement
|
||||
@@ -83,8 +90,11 @@ public class CommandExecutor {
|
||||
}
|
||||
|
||||
if (isCircular){
|
||||
if (!silent) {
|
||||
System.out.println(actualCommand);
|
||||
if (!silent && displayLines != null && !displayLines.isEmpty()) {
|
||||
// Afficher les lignes formatées
|
||||
for (String line : displayLines) {
|
||||
System.out.println(line);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,7 +102,14 @@ public class CommandExecutor {
|
||||
if (ruleNeedsUpdate) {
|
||||
try {
|
||||
if(!isCircular && !silent){
|
||||
System.out.println(actualCommand);
|
||||
// Afficher les lignes formatées
|
||||
if (displayLines != null && !displayLines.isEmpty()) {
|
||||
for (String line : displayLines) {
|
||||
System.out.println(line);
|
||||
}
|
||||
} else {
|
||||
System.out.println(command);
|
||||
}
|
||||
}
|
||||
if (debug) System.out.println("Debug: Executing " + actualCommand);
|
||||
ProcessBuilder pb = new ProcessBuilder("sh", "-c", actualCommand);
|
||||
|
||||
Reference in New Issue
Block a user