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()) {
|
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){
|
if (isCircular){
|
||||||
System.out.println(command);
|
if (!silent) {
|
||||||
|
System.out.println(actualCommand);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// On n'exécute que si nécessaire
|
// On n'exécute que si nécessaire
|
||||||
if (ruleNeedsUpdate) {
|
if (ruleNeedsUpdate) {
|
||||||
try {
|
try {
|
||||||
if(!isCircular){
|
if(!isCircular && !silent){
|
||||||
System.out.println(command);
|
System.out.println(actualCommand);
|
||||||
}
|
}
|
||||||
if (debug) System.out.println("Debug: Executing " + command);
|
if (debug) System.out.println("Debug: Executing " + actualCommand);
|
||||||
ProcessBuilder pb = new ProcessBuilder("sh", "-c", command);
|
ProcessBuilder pb = new ProcessBuilder("sh", "-c", actualCommand);
|
||||||
pb.inheritIO();
|
pb.inheritIO();
|
||||||
Process process = pb.start();
|
Process process = pb.start();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user