0
xtermウィンドウ内でシェルコマンドの実行を制御したいと思います。 これは、サンプルコード(ルビー)です:xterm内で実行されるコマンドをkillする方法
pid = Process.fork
if pid.nil?
exec "xterm -e 'while true; do echo -n .; sleep 1; done'"
else
puts "pid is: #{pid}"
Process.detach(pid)
end
しかし、xtermウィンドウが殺されていません。
$ ./tst2.rb
pid is: 26939
$ ps aux | grep xterm | grep -v grep
user 26939 0.0 0.0 4508 800 pts/3 S 13:11 0:00 sh -c xterm -e 'while true; do echo -n .; sleep 1; done'
user 26943 0.6 0.0 72568 6280 pts/3 S 13:11 0:00 xterm -e while true; do echo -n .; sleep 1; done
$ kill 26939
$ ps aux | grep xterm | grep -v grep
user 26943 0.1 0.0 72568 6280 pts/3 S 13:11 0:00 xterm -e while true; do echo -n .; sleep 1; done
がどのようにxtermウィンドウを殺すことができますか?