fertig
This commit is contained in:
parent
650cf81e71
commit
8d242f6511
2
c.rb
2
c.rb
|
@ -43,5 +43,5 @@ else
|
||||||
$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: ARGV[2]}.to_json)
|
||||||
exec 'perl', 'r.pl', ARGV[2].shdump
|
exec 'perl', 'r.pl', ARGV[2]
|
||||||
end
|
end
|
||||||
|
|
13
r.pl
13
r.pl
|
@ -6,8 +6,8 @@ $|++;
|
||||||
|
|
||||||
$SIG{CLD} = sub {
|
$SIG{CLD} = sub {
|
||||||
wait;
|
wait;
|
||||||
printf STDERR "{proc: \"r\", action: \"exit\", code: 1, error: \"child_died\"}\n";
|
printf STDERR "{proc: \"r\", action: \"exit\", code: $?, error: \"child_died\"}\n";
|
||||||
exit 1;
|
exit $?;
|
||||||
};
|
};
|
||||||
|
|
||||||
sub readcmd {
|
sub readcmd {
|
||||||
|
@ -18,16 +18,15 @@ sub readcmd {
|
||||||
$data;
|
$data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
chdir $ARGV[0] or die( "{proc: \"r\", error: \"cannot_chdir\", exception: \"$!\"}\n");
|
||||||
while( my$data = readcmd) {
|
while( my$data = readcmd) {
|
||||||
(my$cmd, my$length) = unpack( 'nN', $data);
|
(my$cmd, my$length) = unpack( 'nN', $data);
|
||||||
print STDERR "{cmd: $cmd, length: $length}\n";
|
print STDERR "{cmd: $cmd, length: $length}\n";
|
||||||
read STDIN, $data, $length;
|
read STDIN, $data, $length;
|
||||||
if( 1 == $cmd) {
|
if( 1 == $cmd) {
|
||||||
print STDERR "{proc: \"r\", action: \"open\", file: \"$data\"}\n";
|
open( F, '>>', $data) or die( "{proc: \"r\", error: \"unable_to_open_file\", message: \"Can't open file <$data>.\"}\n");
|
||||||
open( F, '>>', $data) or print STDERR ("{proc: \"r\", error: \"unable_to_open_file\", message: \"Can't open file <$data>.\"}\n");
|
my@stat = stat F;
|
||||||
my($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,
|
print pack( 'N', $stat[7]);
|
||||||
$atime,$mtime,$ctime,$blksize,$blocks) = stat F;
|
|
||||||
print pack( 'N', $size);
|
|
||||||
}
|
}
|
||||||
elsif( 2 == $cmd) {
|
elsif( 2 == $cmd) {
|
||||||
print F $data;
|
print F $data;
|
||||||
|
|
Loading…
Reference in a new issue