Name

plash-socket-publish — Make a Plash object reference available via a named socket

Synopsis

plash-socket-publish => socket-pathname /x=variable-name

Description

This program makes a reference to a single Plash object available via a Unix domain socket -- that is, a named socket that appears in the filesystem. This is useful for exporting an object that has been bound to a variable in one instance of the Plash shell, so that it can be used in other instances of the shell (eg. in a different terminal window).

It can be used in conjunction with plash-socket-connect, which connects to a socket and returns a copy of the reference that the socket exports.

If a socket already exists at socket-pathname, the program removes it first. (However, it will give an error if a file exists under that name.)

This command is only useful when used in the Plash shell.

Limitations

The process has to stick around as a proxy to forward method calls.

The program can't tell when it can never receive any more connections -- ie. when the socket has been deleted from the filesystem or replaced -- so it runs indefinitely. You have to stop the program manually.

Examples

def edit_file = capcmd plash-run-emacs ...
plash-socket-publish => ~/tmp/emacs /x=edit_file

Then in another shell:

def edit_file = capcmd plash-socket-connect => ~/tmp/emacs
edit_file => some-file.txt

See also

plash, plash-socket-connect, plash-run-emacs

/usr/share/doc/plash

Author

Mark Seaborn <mseaborn@onetel.com>