</COMMAND_OUTPUT>
<COMMAND_INPUT>
-lttng enable-event ust* -u -s mysession -c mychannel --tracepoint
+lttng enable-event "ust*" -u -s mysession -c mychannel --tracepoint
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_OUTPUT>
<COMMAND_INPUT>
-lttng enable-event ust* -u -s mysession --tracepoint
+lttng enable-event "ust*" -u -s mysession --tracepoint
</COMMAND_INPUT>
<COMMAND_RESULT>
0
</COMMAND_OUTPUT>
<COMMAND_INPUT>
-lttng enable-event u* -u -s mysession --tracepoint
+lttng enable-event "u*" -u -s mysession --tracepoint
</COMMAND_INPUT>
<COMMAND_RESULT>
0
command.append(LTTngControlServiceConstants.OPTION_ALL);
} else {
+ StringBuffer eventNameParameter = new StringBuffer();
for (Iterator<String> iterator = eventNames.iterator(); iterator.hasNext();) {
String event = iterator.next();
- command.append(event);
+ eventNameParameter.append(event);
if (iterator.hasNext()) {
- command.append(',');
+ eventNameParameter.append(',');
}
}
+ command.append(formatParameter(eventNameParameter.toString()));
}
if (isKernel) {
if (eventNames == null) {
command.append(LTTngControlServiceConstants.OPTION_ALL);
} else {
- // no events to enable
+ // no events to disable
if (eventNames.isEmpty()) {
return;
}
+ StringBuffer eventNameParameter = new StringBuffer();
for (Iterator<String> iterator = eventNames.iterator(); iterator.hasNext();) {
String event = iterator.next();
- command.append(event);
+ eventNameParameter.append(event);
if (iterator.hasNext()) {
- command.append(',');
+ eventNameParameter.append(',');
}
}
+ command.append(formatParameter(eventNameParameter.toString()));
}
if (isKernel) {
* - output array
* @return - the formatted output
*/
- protected String formatOutput(ICommandResult result) {
+ public static String formatOutput(ICommandResult result) {
if ((result == null) || result.getOutput() == null || result.getOutput().length == 0) {
return ""; //$NON-NLS-1$
}
StringBuffer newString = new StringBuffer();
newString.append(parameter);
- if (parameter.contains(" ")) { //$NON-NLS-1$
+ if (parameter.contains(" ") || parameter.contains("*")) { //$NON-NLS-1$ //$NON-NLS-2$
newString.insert(0, "\""); //$NON-NLS-1$
newString.append("\""); //$NON-NLS-1$
}
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.linuxtools.internal.lttng2.ui.views.control.logging.ControlCommandLogger;
import org.eclipse.linuxtools.internal.lttng2.ui.views.control.messages.Messages;
+import org.eclipse.linuxtools.internal.lttng2.ui.views.control.preferences.ControlPreferences;
import org.eclipse.linuxtools.internal.lttng2.ui.views.control.remote.ICommandResult;
import org.eclipse.linuxtools.internal.lttng2.ui.views.control.remote.ICommandShell;
*/
public ILttngControlService getLttngControlService(ICommandShell shell) throws ExecutionException {
// get the version
- ICommandResult result = shell.executeCommand(LTTngControlServiceConstants.CONTROL_COMMAND + LTTngControlServiceConstants.COMMAND_VERSION, new NullProgressMonitor());
+ String command = LTTngControlServiceConstants.CONTROL_COMMAND + LTTngControlServiceConstants.COMMAND_VERSION;
+
+ if (ControlPreferences.getInstance().isLoggingEnabled()) {
+ ControlCommandLogger.log(command);
+ }
+
+ ICommandResult result = shell.executeCommand(command, new NullProgressMonitor());
+
+ if (ControlPreferences.getInstance().isLoggingEnabled()) {
+ ControlCommandLogger.log(LTTngControlService.formatOutput(result));
+ }
if ((result != null) && (result.getResult() == 0) && (result.getOutput().length >= 1) && (!LTTngControlServiceConstants.ERROR_PATTERN.matcher(result.getOutput()[0]).matches())) {
int index = 0;