[e-lang] Questions: Close network connections, display command line from app, etrace
Mark S. Miller
markm at cs.jhu.edu
Tue Jan 23 23:44:02 CST 2007
Martin Scheffler wrote:
> - How can I prevent or at least catch the killConnection error that
> I get on my server when I close a connected client?
A network partition or a vat termination breaks remote references. When a
remote reference breaks, the object designated by this reference, such as your
server, receives a __reactToLostClient(problem) message, notifying it that one
of its clients allegedly might not be able to speak to it. (See sections 17.2
and 11.5.3 of <http://erights.org/talks/thesis/>)
The provided problem argument is allegedly why one of its clients might not be
able to communicate -- typically <SocketException: Connection reset>. Note
that any client, local or remote, may send such a message of their own
volition, even if no reference actually broke.
> - How can I open a rune command line from a running script? I would
> like to be able to enter E commands into my program after it has
> started.
The rune function is defined in the privileged scope to act much like the rune
shell command. For example, just like you can say
$ rune --version
from the bash shell, you can say
? rune(["--version"])
from within a rune command line. Since the rune command with no arguments
opens an interactive rune command line, from inside an E program you can call
rune([])
or
rune(["--interact", "-.e"])
to start an interactive rune command line. The source code of rune.e is:
-----------------------------------------------
#!/usr/bin/env rune
pragma.syntax("0.8")
# Copyright 2002 Combex, Inc. under the terms of the MIT X license
# found at http://www.opensource.org/licenses/mit-license.html ...............
def outcome :vow[boolean] := rune(interp.getArgs())
interp.waitAtTop(outcome)
interp.exitAtTop(Ref.optProblem(outcome))
-----------------------------------------------
The source for the rune function is
src/esrc/org/erights/e/elang/cmd/runeAuthor.emaker, and will "explain" how
rune is built up from various components.
> - Can I tell E to output the etrace data directly to stderr instead
> of to a file?
You can set the "TraceLog_dir" property to "-", which indicates stderr rather
than an actual directory.
$ rune -DTraceLog_dir=-
See <http://www.erights.org/elib/Tracing.html#controlling_the_log_at_launch_time>
--
Text by me above is hereby placed in the public domain
Cheers,
--MarkM
More information about the e-lang
mailing list