Method: SystemBrowser::Client#start

Defined in:
lib/system_browser/client.rb

#startInteger

Note:

@init_pid and @window_pid are two different processes. The

Spawns a new process in a new process group. I really wanted to find the way to spawn the process in the same group. However, when I do that, I cannot send any signals to the window anymore (the app crashes, because the ruby process exits).

client uses @init_id to bootstrap itself and @window_pid is the process that can be used to send signals to the client.

Returns:

  • (Integer)

    the process ID of the client application

Raises:

  • (RuntimeError)


34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/system_browser/client.rb', line 34

def start
  executable = self.client_executable

  unless system("which #{executable} > /dev/null 2>&1")
    fail ClientNotFoundError, "executable '#{executable}' is not on your $PATH"
  end

  @init_pid = spawn(executable, pgroup: true)
  Process.wait(@init_pid)

  @init_pid
end