On Jun 8, 2008, at 12:13 PM, A. Lester Buck III wrote:
> I want to send a Windows popup from a Linux machine.  smbclient is
> the standard utility, and  it will accept a file on standard
> input to avoid terminal interaction, viz.
>
>    smbclient -M netbiosname < /tmp/message.text
>
>>
> From my reading of the Ruby Cookbook, recipes 6.15 and 6.16, this
> "should" work:
>
> =========
> #!/usr/bin/ruby -w
>
> require 'stringio'
>
> $stdin = StringIO.new "This is the test message"
>
> system("smbclient -M netbiosname")
> =========
>
> Alas, it ignores the input message and prompts for terminal input
> terminated by ^D.
>
>
> Could someone please show me the correct code to use in a Ruby
> script to send a string to a Windows popup?

You'll have to use #reopen with a real file instead.  Assigning to  
$stdin only affects ruby's interpretation of standard input, not the C  
standard input.