Ajout de la gestion des commandes silencieuses dans CommandExecutor
This commit is contained in:
parent
2e285862b7
commit
01c5954b5b
@ -71,18 +71,25 @@ public class CommandExecutor {
|
||||
}
|
||||
|
||||
for (String command : rule.getCommands()) {
|
||||
// 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
|
||||
String actualCommand = silent ? command.substring(1) : command;
|
||||
|
||||
if (isCircular){
|
||||
System.out.println(command);
|
||||
if (!silent) {
|
||||
System.out.println(actualCommand);
|
||||
}
|
||||
}
|
||||
|
||||
// On n'exécute que si nécessaire
|
||||
if (ruleNeedsUpdate) {
|
||||
try {
|
||||
if(!isCircular){
|
||||
System.out.println(command);
|
||||
if(!isCircular && !silent){
|
||||
System.out.println(actualCommand);
|
||||
}
|
||||
if (debug) System.out.println("Debug: Executing " + command);
|
||||
ProcessBuilder pb = new ProcessBuilder("sh", "-c", command);
|
||||
if (debug) System.out.println("Debug: Executing " + actualCommand);
|
||||
ProcessBuilder pb = new ProcessBuilder("sh", "-c", actualCommand);
|
||||
pb.inheritIO();
|
||||
Process process = pb.start();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user