Github user neykov commented on a diff in the pull request:

    https://github.com/apache/incubator-brooklyn/pull/980#discussion_r42622467
  
    --- 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 --
    
    Good point for the null check, but then you would loose subsequent streams 
when called multiple times. Doesn't feel right that the machine code deals with 
task related responsibilities.
    You are basically re-implementing SshTasks so why not just use it.


---
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.
---

Reply via email to