This is an automated email from the ASF dual-hosted git repository.

clebertsuconic pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/activemq-artemis.git


The following commit(s) were added to refs/heads/main by this push:
     new 07a7928483 ARTEMIS-4974 Dot not allow run in the Shell execution
07a7928483 is described below

commit 07a7928483ffcbcf2582e3e3e1a6544ebdbce61a
Author: Clebert Suconic <[email protected]>
AuthorDate: Mon Aug 5 13:51:43 2024 -0400

    ARTEMIS-4974 Dot not allow run in the Shell execution
---
 .../java/org/apache/activemq/artemis/cli/commands/Run.java   | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git 
a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/Run.java 
b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/Run.java
index 219a581306..6a4826f8fe 100644
--- 
a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/Run.java
+++ 
b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/Run.java
@@ -25,6 +25,7 @@ import 
org.apache.activemq.artemis.api.config.ActiveMQDefaultConfiguration;
 import org.apache.activemq.artemis.api.core.Pair;
 import org.apache.activemq.artemis.cli.Artemis;
 import org.apache.activemq.artemis.cli.Shell;
+import org.apache.activemq.artemis.cli.Terminal;
 import org.apache.activemq.artemis.cli.commands.tools.LockAbstract;
 import org.apache.activemq.artemis.cli.factory.BrokerFactory;
 import org.apache.activemq.artemis.cli.factory.jmx.ManagementFactory;
@@ -75,6 +76,17 @@ public class Run extends LockAbstract {
 
    @Override
    public Object execute(ActionContext context) throws Exception {
+
+      if (Shell.inShell()) {
+
+         String scriptStart = "./artemis";
+         if (System.getProperty("os.name", 
"linux").toLowerCase().trim().startsWith("win")) {
+            scriptStart = "artemis.cmd";
+         }
+         System.out.println(Terminal.RED_UNICODE + "ERROR: The run command is 
not supported in the artemis shell. Please use '" + scriptStart + " run' 
directly." + Terminal.CLEAR_UNICODE);
+         return null;
+      }
+
       super.execute(context);
 
       verifyOlderLogging(new File(getBrokerEtc()));


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information, visit: https://activemq.apache.org/contact


Reply via email to