Sha256: 71c246b790f40b74e91ee8ab805f4a0b38ae6890c8db023ea2683b5b5e47a0a8

Contents?: true

Size: 1.23 KB

Versions: 4

Compression:

Stored size: 1.23 KB

Contents

#!/usr/bin/env ruby

# Copyright (c) 2007, 2009 Samuel Williams. Released under the GNU GPLv3.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# 
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

require 'rubygems'
require 'rexec'

CLIENT = <<EOF

$connection.run do |path|
  listing = []

  IO.popen("ls -la " + path.dump, "r+") do |ls|
    listing = ls.readlines
  end

  $connection.send_object(listing)
end

EOF

command = ARGV[0] || "ruby"

puts "Starting server..."
RExec::start_server(CLIENT, command) do |conn, pid|
  puts "Sending path..."
  conn.send_object("/")

  puts "Waiting for response..."
  listing = conn.receive_object

  puts "Received listing:"
  listing.each do |entry|
    puts "\t#{entry}"
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rexec-1.2.1 test/listing_example.rb
rexec-1.1.12 test/listing_example.rb
rexec-1.1.11 test/listing_example.rb
rexec-1.1.10 test/listing_example.rb