From ed0d2684c14af5893188f3e671005e9e84a98ef5 Mon Sep 17 00:00:00 2001 From: Denis Knauf Date: Wed, 29 Sep 2010 13:33:50 +0200 Subject: [PATCH] you may not change dir to c.rb --- c.rb | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/c.rb b/c.rb index c7e3f05..274d99b 100755 --- a/c.rb +++ b/c.rb @@ -1,6 +1,7 @@ #!/usr/bin/env ruby -require 'json' +libexec = File.expand_path File.dirname( __FILE__) +machine, source, destination = ARGV[0...3] class IO def readall @@ -35,13 +36,13 @@ if Process.fork tor.last.close $stdout.reopen tos.last tos.first.close - $stderr.puts( {proc: 'c', connect: ARGV[0], args: ARGV[1]}.to_json) - exec 'ssh', ARGV[0], 'perl', '-e', File.readall( 's.pl').shdump, ARGV[1].shdump + $stderr.puts( {proc: 'c', machine: machine, source: source}.inspect) + exec 'ssh', machine, 'perl', '-e', File.readall( File.join( libexec, 's.pl')).shdump, source.shdump else $stdin.reopen tos.first tos.last.close $stdout.reopen tor.last tor.first.close - $stderr.puts( {proc: 'c', exec: 'reciever', destination: ARGV[2]}.to_json) - exec 'perl', 'r.pl', ARGV[2] + $stderr.puts( {proc: 'c', exec: 'reciever', destination: destination}.inspect) + exec 'perl', File.join( libexec, 'r.pl'), destination end