you may not change dir to c.rb

master
Denis Knauf 2010-09-29 13:33:50 +02:00
parent 9fab78689b
commit ed0d2684c1
1 changed files with 6 additions and 5 deletions

11
c.rb
View File

@ -1,6 +1,7 @@
#!/usr/bin/env ruby #!/usr/bin/env ruby
require 'json' libexec = File.expand_path File.dirname( __FILE__)
machine, source, destination = ARGV[0...3]
class IO class IO
def readall def readall
@ -35,13 +36,13 @@ if Process.fork
tor.last.close tor.last.close
$stdout.reopen tos.last $stdout.reopen tos.last
tos.first.close tos.first.close
$stderr.puts( {proc: 'c', connect: ARGV[0], args: ARGV[1]}.to_json) $stderr.puts( {proc: 'c', machine: machine, source: source}.inspect)
exec 'ssh', ARGV[0], 'perl', '-e', File.readall( 's.pl').shdump, ARGV[1].shdump exec 'ssh', machine, 'perl', '-e', File.readall( File.join( libexec, 's.pl')).shdump, source.shdump
else else
$stdin.reopen tos.first $stdin.reopen tos.first
tos.last.close tos.last.close
$stdout.reopen tor.last $stdout.reopen tor.last
tor.first.close tor.first.close
$stderr.puts( {proc: 'c', exec: 'reciever', destination: ARGV[2]}.to_json) $stderr.puts( {proc: 'c', exec: 'reciever', destination: destination}.inspect)
exec 'perl', 'r.pl', ARGV[2] exec 'perl', File.join( libexec, 'r.pl'), destination
end end