X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=jreplclient;h=82e113b70f069e52ec92afa17ff975dc441c2612;hb=ac134649b64cae32203281cc3b40b612e4a07d7e;hp=1ebeaee231c017fdbef888e2cd432c4d447933c7;hpb=ff0abfbabde8da2ea39f95faf12f6f38d895d950;p=scpubgit%2FTak.git diff --git a/jreplclient b/jreplclient index 1ebeaee..82e113b 100644 --- a/jreplclient +++ b/jreplclient @@ -7,14 +7,25 @@ use JSON::PP qw(encode_json decode_json); my $cmd = do { if (my $host = $ARGV[0]) { - 'cat jsonrepl.packed - | ssh '.$host.' perl -' + 'ssh '.$host.' perl -' } else { - 'perl jsonrepl' + 'perl -' } }; my $pid = open2(my $out, my $in, $cmd); +{ + my $jr; + if (!eof(*DATA)) { + $jr = \*DATA + } else { + open $jr, '<', 'jsonrepl.packed' or die "No packed repl: $!"; + } + while (<$jr>) { print $in $_ } + print $in "__END__\n"; +} + my $read = Term::ReadLine->new('REPL'); while (1) {