Add tags

Add tags to the following comment

fork ってみた

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
use strict;
use warnings;
use POSIX qw( SIGKILL SIGINT );
BEGIN { system 'stty -echo -icanon >/dev/tty' }
END{    system 'stty echo icanon   >/dev/tty' }

my $pid = fork;
if($pid) {
  for(;;){
    my $a = getc;
    if($a eq 'q') {
      kill SIGKILL , $pid;
      exit;
    }
    elsif($a eq 'p') {
      kill SIGINT , $pid;
    }
  }
}
else {
  my $flag = 1;
  local $| = 1;
  local $SIG{INT} = sub(){ $flag = !$flag };
  for(;;){
    print "a" if $flag;
    sleep 1;
  }
}

Add tags

The input will be splited to tags with space.

Index

Feed

Other

Link

Pathtraq

loading...