Commit Graph

74 Commits

Author SHA1 Message Date
Qi Xiao
d6464280f2 Remove direct dependency of pkg/shell on the daemon implementation.
The dependency is injected via a field in shell.Program.

Also add an alternative entrypoint, cmd/nodaemon/elvish, which does not include
the daemon server or client.
2021-06-19 01:43:30 +01:00
Qi Xiao
27eec7c8ee Reorganize the daemon module.
* Move client, spawning and activation code into pkg/daemon/client.

* Move API types into pkg/daemon/daemondefs.
2021-06-19 01:06:11 +01:00
Kurtis Rader
60bcb27e16 Remove obsolete store API method
While working on issue #568 to add a `&dedup` option to the
`edit:command-history` command I noticed that the `store.Cmd.Cmds()`
method should be removed.
2021-05-30 00:33:37 +01:00
Qi Xiao
72fc2dbe4a Copy and trim down the net/rpc package.
In particular, the dependency on net/http is removed, which removes a
bunch of transitive dependencies.
2021-01-30 23:56:58 +00:00
Qi Xiao
196eea21d4 Change module import path to src.elv.sh 2021-01-27 01:30:25 +00:00
Qi Xiao
327561ed0a pkg/daemon: Move the opening of stdin for the daemon to spawn.go. 2021-01-17 00:12:36 +00:00
Kurtis Rader
d241243fdf Ensure the daemon doesn't have fds open on the tty
The Elvish daemon should not inherit file descriptors open on the tty.
Make the daemon's stdin open on the null device and its stdout/stderr
open on a predictable file.

Fixes #1191
2021-01-16 23:18:38 +00:00
Qi Xiao
11898f763a pkg/util: Break into fsutil/ and logutil/. 2020-09-03 05:27:18 +01:00
Qi Xiao
48919bcb24 pkg/: Move test utilities from util/ to testutil/. 2020-09-03 04:55:16 +01:00
Kurtis Rader
b5b3a0d607 go vet cleanup
Most of the code uses keyed fields in composite literals; i.e., struct
literals. However, running `go vet ./...` reports a few places that use
anonymous fields. This modifies those composite literals to use keyed
fields. This does make the code a bit more verbose without reducing
the likelihood of a bug. But it does make the code more consistent, use
best practices, and make it easier to notice if a potential problem is
introduced when running `go vet ./...` since that command now produces
no diagnostic output.

I considered adding a `make vet` target that explicitly ran

    go vet -composites=false ./...

I decided not to do that since consistently using keyed composite literals
is preferable to having a mix of keyed and unkeyed composite literals.

This also removes the unused `ExampleLoop` function which causes this
`go vet` warning:

    pkg/cli/loop_test.go:130:1: ExampleLoop refers to unknown identifier: Loop
2020-09-03 04:24:06 +01:00
Qi Xiao
928949077b pkg/prog: Move all Program implementations into own packages.
This fixes #985.
2020-04-25 00:12:18 +01:00
Qi Xiao
f55bc315c9 pkg/daemon: Run tests from pkg/store/storetest.
This addresses #944.

Also fix a bug with DelSharedVar that was found by the new test.
2020-04-06 00:48:48 +01:00
Qi Xiao
b93ef8aa4a pkg/daemon: Add more tests, and remove unused code.
This addresses #944.
2020-04-06 00:19:03 +01:00
Qi Xiao
04e296bb10 pkg/program/daemon: Merge with pkg/daemon. 2020-04-04 16:50:25 +01:00
Qi Xiao
770fd8e6c4 Scale all test timeouts with $ELVISH_TEST_TIME_SCALE. 2020-04-03 22:12:20 +01:00
Qi Xiao
f6d036cb48 pkg/daemon: Fix the CmdsWithSeq client. 2019-12-28 02:01:39 +00:00
Qi Xiao
95b9ba91d8 pkg/{store,daemon}: Introduce a new CmdsWithSeq method. 2019-12-27 11:48:34 +00:00
Qi Xiao
c2d82cafe5 pkg/store: Introduce a Cmd type for command history entries.
This type supersededs pkg/cli/histutil.Entry.
2019-12-27 11:13:33 +00:00
Qi Xiao
6b876e559d pkg/store: Interface -> Store. 2019-12-26 18:09:26 +00:00
Qi Xiao
cbe0e3e7e7 Merge pkg/store/storedefs into pkg/store. 2019-12-26 18:05:13 +00:00
Qi Xiao
e6497a87cc pkg/daemon: Move Version back to the daemon package. 2019-12-26 17:31:15 +00:00
Qi Xiao
8ed2c0c461 pkg/daemon: Move API types into an internal package. 2019-12-26 17:26:59 +00:00
Qi Xiao
012b779ca7 pkg/daemon: Make Client an interface. 2019-12-26 17:23:18 +00:00
Qi Xiao
e45fdf7228 Move all libraries to new pkg/. 2019-12-23 20:00:59 +00:00