Method: PureData#stop

Defined in:
lib/puredata/pd.rb

#stopObject



83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
# File 'lib/puredata/pd.rb', line 83

def stop
  if @sock
    @sock.close unless @sock.closed?
    @sock = nil
  end

  return if @pid.nil?

  begin
    Process.kill(:TERM, -@pid)
  rescue Errno::ESRCH
  rescue Errno::EPERM
    raise "fail to kill process(#{@pid}): #{$!}"
  end
  Process.waitpid(@pid)
ensure
  @sock = nil
  @pid = nil
end