common: Add cockpit_pipe_spawn() function to create process pipe

This is more general than cockpit_pipe_transport_spawn(). Once we
migrate to libssh then cockpit_pipe_transpown_spawn() should be
rewritten to use cockpit_pipe_spawn().

Since we'd like to use this as a cockpit_pipe_transport_spawn()
constructor, allow passing the gtype. In theory we would make all
these arguments be constructor arguments of CockpitPipe and then
pass it all in that way. But man that's tiring and less readable.
common: Close failed CockpitPipe in right thread context

CockpitPipe is not thread-safe, so it's close-on-fail-during-init
idle handler needs to be called in the thread main context for
the thread in which it was created.
common: Add cockpit_pipe_get_pid() function

We're needing to check on the pid, and whether a pipe has a pid
in a few places. So make this a real function instead of forcing
use of g_object_get (pipe, "pid", ...);

In addition guarantee that cockpit_pipe_get_pid() will still return
the pid after 'close' has fired.

Also add some testing infrastructure to test-pipe. This will be
used further in later commits.
common: Rename CockpitPipe 'closed' signal to 'close'

It was conflicting with CockpitTransport's 'closed' signal and
CockpitPipeTransport ended up with both overlapping.

The 'close' name matches the other method and signal names in
CockpitPipe better as well.
common: Split exit status handling out of CockpitPipe

The exit status handling in CockpitPipe was very specific to
the launch code in cockpit_pipe_transport_spawn(). Move this
logic into CockpitPipeTransport instead.

We want to use CockpitPipe for arbitrary processes and need
clean exit code handling.

Add cockpit_pipe_exit_status() function for retrieving the
exit status of the reaped child process.
agent: Add cockpit_channel_get_bool_option() function

And implement it using cockpit_json_get_bool() which does the usual
checks for the correct member type.
agent: Implement text-stream channel with spawn argument

This launches a process and connects the channel to the standard
input and standard output of the spawned process. Standard error
goes to the same output as the agent's unless redirected.

The command is not passed to the shell, it should be a full
executable path.

The doc/protocol.md documentation has some details on how
to call this.
common: Properly handle case where pipe closing both in/out

When pipe is asked to close output, but not a socket and the
input file descriptor is equal to the output fd, then we have
to close both. This means we stop reading input as well.

Previously this case would cause a critical warning and reading
from an invalid file descriptor.
cockpit: Implement cockpit_pipe_pty() function

This opens up a pipe with a pty provided by forkpty() and lets
us communicate with that pty.
agent: Implement pty option for CockpitTextStream

This lets us open a pty by specifying 'pty': true in the channel
options.
web: Implement a proper terminal on rescue terminal page

Use a proper terminal from term.js on the terminal page.

Fixes #434
Cloles #472
common: Tweak test output a bit

For more visibility in CI. Also remove unnecessary init
from test-pipe.c