oh-my-git/scripts/fake-editor

21 lines
612 B
Text
Raw Normal View History

2020-09-09 18:32:57 +02:00
#!/usr/bin/env perl
2020-09-09 18:32:57 +02:00
use IO::Socket;
2020-10-06 16:50:31 +02:00
use File::Spec;
2020-09-09 18:32:57 +02:00
$socket = IO::Socket::INET->new(PeerAddr => "127.0.0.1",
PeerPort => 1234,
Proto => "tcp",
Type => SOCK_STREAM);
2020-10-06 16:50:31 +02:00
my $absolute_path = File::Spec->rel2abs($ARGV[0]);
# Send the length of the first argument as a byte.
2020-10-06 16:50:31 +02:00
$socket->send(chr(length($absolute_path)));
# Send the first argument as a string.
2020-10-06 16:50:31 +02:00
$socket->send($absolute_path);
# This call is intended to block, we're waiting for Godot to close the connection.
2020-09-09 18:32:57 +02:00
my $reply;
$socket->read($reply, 1000);