Commit Graph

18 Commits

Author SHA1 Message Date
Qi Xiao
7a72b6346a Reorganize pkg/sys into portable and non-portable system utilities.
Non-portable ones are moved into new packages pkg/sys/e{unix windows}. The "e"
prefix is needed to avoid conflict with packages under golang.org/x/sys/ and can
mean "extra".
2021-10-02 13:14:00 +01:00
Qi Xiao
d0be34c227 Run gofmt with Go 1.17.
This has created a lot of //go:build lines.
2021-08-23 00:19:49 +01:00
Qi Xiao
83c81cc5b2 Fix unused symbols found by staticcheck.
Also consolidate pkg/sys/testutil_test.go into pkg/sys/select_test.go.
2021-06-15 17:46:31 +01:00
Kurtis Rader
2b6b11c230 Exercise testutil.MustPipe
I noticed that testutil.MustPipe was not covered by any unit tests. This
converts the handful of places that should use it to do so. This changes
the coverage of pkg/testutil/must.go from 61.5% to 73.1%. There isn't
any way to increase that further without explicitly testing the panic
paths.
2021-06-02 20:29:34 -07:00
Qi Xiao
196eea21d4 Change module import path to src.elv.sh 2021-01-27 01:30:25 +00:00
Shengjing Zhu
6c08de0ff3 Fix typos found by codespell 2020-10-10 22:47:50 +01:00
Kurtis Rader
eed744044c Eliminate sys.Ioctl
I started by writing tests for sys.Ioctl but after I had 100% coverage
of that function it occurred to me the function could be eliminated.

Related #1062
2020-08-27 15:51:29 +01:00
Qi Xiao
a90e8eb75d Revert "Eliminate sys.Ioctl"
Results in "failed to put myself in foreground" errors.

This reverts commit bea90271b0.
2020-08-16 14:23:37 +01:00
Kurtis Rader
bea90271b0 Eliminate sys.Ioctl
I started by writing tests for sys.Ioctl but after I had 100% coverage
of that function it occurred to me the function could be eliminated.

Related #1062
2020-08-16 14:14:48 +01:00
Qi Xiao
7ddcc5b1b5 pkg/sys: Document why it's necessary to call signal.Ignore. 2020-07-11 14:26:30 +01:00
Kurtis Rader
c30a9ff9ad Tell external cmds to ignore job control signals
Since elvish does not support job control it should run all external
commands with the tty job control signals set to be ignored. See "APUE",
third edition, page 379.

This doesn't actually fix the problem in the case of broken programs
like vim which blindly assume the parent process implements job control.
But there isn't much we can do about that other than try to get those
programs to pay attention to being told to ignore SIGTSTP.

Fixes #988
2020-07-11 14:18:42 +01:00
Kurtis Rader
4bfb6e2aad Fix how [ctrl-v] works on BSD systems
On BSD systems iexten has to be explicitly disabled. Whereas on Linux
systems it is implicitly ignored if icanon is disabled.

Fixes #917
2020-04-24 21:41:35 +01:00
Qi Xiao
4ca283ecf4 pkg/sys: Temporarily disable select_test.go on darwin.
It seems that unix.Pipe in the latest master version is buggy on Darwin.
2020-01-16 08:32:38 -05:00
Qi Xiao
f7a5b6002a pkg/sys: Unify select_{linux,bsd}.go. 2020-01-14 10:17:25 -05:00
Qi Xiao
61c9b92d54 pkg/sys: Remove fd_freebsd.go.
The latest version of golang.org/x/sys/unix no longer has the discrepancy in
field name on FreeBSD.
2020-01-14 10:07:30 -05:00
Qi Xiao
e8ed51b2ae pkg/sys: Fix tests. 2019-12-31 21:27:24 +00:00
Qi Xiao
52b5e23d73 pkg/sys: Support timeout in WaitForRead. 2019-12-31 21:14:02 +00:00
Qi Xiao
e45fdf7228 Move all libraries to new pkg/. 2019-12-23 20:00:59 +00:00