|
@@ -22,17 +22,15 @@
|
22
|
22
|
|
23
|
23
|
package com.dmdirc.addons.exec;
|
24
|
24
|
|
25
|
|
-import com.dmdirc.DMDircMBassador;
|
26
|
25
|
import com.dmdirc.commandparser.BaseCommandInfo;
|
27
|
26
|
import com.dmdirc.commandparser.CommandArguments;
|
28
|
27
|
import com.dmdirc.commandparser.CommandType;
|
29
|
28
|
import com.dmdirc.commandparser.commands.Command;
|
30
|
29
|
import com.dmdirc.commandparser.commands.context.CommandContext;
|
31
|
|
-import com.dmdirc.events.UserErrorEvent;
|
32
|
30
|
import com.dmdirc.interfaces.CommandController;
|
33
|
31
|
import com.dmdirc.interfaces.WindowModel;
|
34
|
|
-import com.dmdirc.logger.ErrorLevel;
|
35
|
32
|
import com.dmdirc.util.CommandUtils;
|
|
33
|
+import com.dmdirc.util.LogUtils;
|
36
|
34
|
import com.dmdirc.util.io.StreamUtils;
|
37
|
35
|
|
38
|
36
|
import com.google.common.io.CharStreams;
|
|
@@ -45,28 +43,23 @@ import java.util.List;
|
45
|
43
|
import javax.annotation.Nonnull;
|
46
|
44
|
import javax.inject.Inject;
|
47
|
45
|
|
|
46
|
+import org.slf4j.Logger;
|
|
47
|
+import org.slf4j.LoggerFactory;
|
|
48
|
+
|
48
|
49
|
/**
|
49
|
50
|
* A command which allows users execute scripts.
|
50
|
51
|
*/
|
51
|
52
|
public class ExecCommand extends Command {
|
52
|
53
|
|
|
54
|
+ private static final Logger LOG = LoggerFactory.getLogger(ExecCommand.class);
|
53
|
55
|
/** A command info object for this command. */
|
54
|
56
|
public static final BaseCommandInfo INFO = new BaseCommandInfo("exec",
|
55
|
57
|
"exec <command> [<parameters>] - executes an external program "
|
56
|
58
|
+ "and displays the output", CommandType.TYPE_GLOBAL);
|
57
|
|
- /** Event bus to post errors to. */
|
58
|
|
- private final DMDircMBassador eventBus;
|
59
|
59
|
|
60
|
|
- /**
|
61
|
|
- * Creates a new instance of this command.
|
62
|
|
- *
|
63
|
|
- * @param controller The controller to use for command information.
|
64
|
|
- * @param eventBus The event bus to post errors to
|
65
|
|
- */
|
66
|
60
|
@Inject
|
67
|
|
- public ExecCommand(final CommandController controller, final DMDircMBassador eventBus) {
|
|
61
|
+ public ExecCommand(final CommandController controller) {
|
68
|
62
|
super(controller);
|
69
|
|
- this.eventBus = eventBus;
|
70
|
63
|
}
|
71
|
64
|
|
72
|
65
|
@Override
|
|
@@ -103,8 +96,7 @@ public class ExecCommand extends Command {
|
103
|
96
|
}
|
104
|
97
|
}
|
105
|
98
|
} catch (IOException ex) {
|
106
|
|
- eventBus.publishAsync(new UserErrorEvent(ErrorLevel.LOW, ex,
|
107
|
|
- "Unable to run application: " + ex.getMessage(), ""));
|
|
99
|
+ LOG.info(LogUtils.USER_ERROR, "Unable to run application: {}", ex.getMessage(), ex);
|
108
|
100
|
}
|
109
|
101
|
}
|
110
|
102
|
|