Github user iyovcheva commented on a diff in the pull request:
https://github.com/apache/incubator-brooklyn/pull/980#discussion_r42619079
--- Diff:
core/src/main/java/org/apache/brooklyn/location/ssh/SshMachineLocation.java ---
@@ -664,6 +655,24 @@ public int execCommands(Map<String,?> props, String
summaryForLogging, List<Stri
public int execCommands(String summaryForLogging, List<String>
commands, Map<String,?> env) {
return execCommands(MutableMap.<String,Object>of(),
summaryForLogging, commands, env);
}
+ public int execCommandsWithStreams(String summaryForLogging,
List<String> commands) {
+ Map flags = Maps.newLinkedHashMap();
+ if (BrooklynTaskTags.stream(Tasks.current(),
BrooklynTaskTags.STREAM_STDIN)==null) {
+
Tasks.addTagDynamically(BrooklynTaskTags.tagForStreamSoft(BrooklynTaskTags.STREAM_STDIN,
+ Streams.byteArrayOfString(Strings.join(commands,
"\n"))));
+ }
+ if (BrooklynTaskTags.stream(Tasks.current(),
BrooklynTaskTags.STREAM_STDOUT)==null) {
+ ByteArrayOutputStream stdout = new ByteArrayOutputStream();
+ ByteArrayOutputStream stderr = new ByteArrayOutputStream();
+
Tasks.addTagDynamically(BrooklynTaskTags.tagForStreamSoft(BrooklynTaskTags.STREAM_STDOUT,
stdout));
+
Tasks.addTagDynamically(BrooklynTaskTags.tagForStreamSoft(BrooklynTaskTags.STREAM_STDERR,
stderr));
--- End diff --
Hi @neykov, I think that this is impossible, because the tags are
Set<Object> and even there was no `==null` check, if the tags are already in,
the set will remain unchanged.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---