Hello,
        I'm trying out the address ... with output replace stream 'streamName' 
instruction, but it doesn't behave the way I
would expect, and there are no examples in either of the ooRexx manuals for 
other than stem and array.

        What I'm trying to do is issue several OS commands and capture each 
command's output using the stream option.
The first address instruction works as expected, but successive address 
instructions return no lines.

        Attached are two test programs that show the problem I'm having.

        Perhaps I'm using stream incorrectly or inappropriately? but I can't 
tell by what is in the manuals.

Leslie
--Platform: Linux
Distribution: openSUSE Leap 15.4 (x86_64)
Open Object Rexx Version 5.0.0 r12583
Build date: Dec 23 2022
Addressing mode: 64
#!/usr/bin/env rexx
-- Unexpected behaviour with serial reuse of
--   address command ... using output replace stream 'streamName'

  osCommand = .Stream ~ new('osCommand')

  address command 'echo "First use of stream osCommand."' with output replace 
stream 'osCommand'
  say 'First use of stream osCommand returned' osCommand ~ lines 'lines.'

  loop C = 1 to osCommand ~ lines
    say 'osCommand line' C':' osCommand ~ lineIn
  end

  say 'First use of stream osCommand ended with rc' rc'.'

  say
  address command 'echo "Second use of stream osCommand."' with output replace 
stream 'osCommand'
  say 'Second use of stream osCommand returned' osCommand ~ lines 'lines.'

  loop C = 1 to osCommand ~ lines
    say 'osCommand line' C':' osCommand ~ lineIn
  end

  say 'Second use of stream osCommand ended with rc' rc'.'
exit rc
#!/usr/bin/env rexx
-- Unexpected behaviour with serial reuse of
--   address command ... using output replace stream 'streamName'

  osCommand = .Stream ~ new('osCommand')
  address command with output replace stream 'osCommand'

  address command 'echo "First use of stream osCommand."'
  say 'First use of stream osCommand returned' osCommand ~ lines 'lines.'

  loop C = 1 to osCommand ~ lines
    say 'osCommand line' C':' osCommand ~ lineIn
  end

  say 'First use of stream osCommand ended with rc' rc'.'

  say
  address command 'echo "Second use of stream osCommand."'
  say 'Second use of stream osCommand returned' osCommand ~ lines 'lines.'

  loop C = 1 to osCommand ~ lines
    say 'osCommand line' C':' osCommand ~ lineIn
  end

  say 'Second use of stream osCommand ended with rc' rc'.'
exit rc
_______________________________________________
Oorexx-devel mailing list
Oorexx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/oorexx-devel

Reply via email to