Commit Graph

35 Commits

Author SHA1 Message Date
Qi Xiao
33cca983f1 pkg/sys/ewindows: Regenerate ztyles_windows.go.
Also remove types_src_windows.go; it contains the same content as
types.go.
2023-03-12 22:06:52 +00:00
Kurtis Rader
34bd94dcd6 Remove obsolete build constraints 2023-03-12 21:58:18 +00:00
Qi Xiao
2a4740a523 pkg/sys/eunix: Simplify build constraints for the termiosFlag definition. 2023-03-11 20:08:56 +00:00
Kurtis Rader
2dc067dcb3 Fix some Go build/lint/test constraints 2023-03-11 19:58:54 +00:00
Qi Xiao
0adf0ec147 Use the unix build tag.
The unix build tag is supported by Go 1.19.
2023-03-03 00:01:26 +00:00
Qi Xiao
de3a7fd1b3 Standardize spelling: UNIX -> Unix.
https://en.wikipedia.org/wiki/Unix#Branding contains a history of the spelling.
Follow Wikipedia in using Unix instead of UNIX.
2023-01-04 18:09:11 +00:00
Qi Xiao
5e6954dbf3 Add a doc: module for accessing documentation of Elvish modules.
This fixes #1432.
2022-12-26 21:36:07 +00:00
Qi Xiao
a18aec1ac8 Fixup for #1598.
- Let file:is-tty always take one argument.

- Revert change to eval.ByteOutput.

- Make sys.IsATTY take a FD instead, to avoid the need to use os.NewFile. Using
  os.NewFile can cause the Go runtime to start polling the file, which
  interferes with Elvish's terminal reader.
2022-11-20 16:21:10 +00:00
Qi Xiao
2e788c846d Run gofmt.
https://tip.golang.org/doc/go1.19#go-doc
2022-08-07 22:30:11 +01:00
Qi Xiao
fbf0bfc13b pkg/sys: Double init size of stack trace buf.
4KB is likely insufficient.
2022-06-23 21:48:12 +01:00
Qi Xiao
4afbb71c07 Move pkg/testutil/must.go to a new pkg/must. 2022-06-20 20:29:14 +01:00
Qi Xiao
f7cb556d9b Require Go 1.18.
- Run "go fix" to remove legacy build tags

- Use staticcheck@master until it has a release that supports Go 1.18

- Turn off autocrlf for Windows tasks
2022-03-20 15:28:23 +00:00
Qi Xiao
3172a259b9 Fix cmd/examples/win_tty 2021-10-02 22:44:54 +01:00
Qi Xiao
3585d933b8 pkg/sys/ewindows: Remove the _windows suffix from most files.
All the files in this package are Windows-specific. Use build
constraints to ensure that they don't build on other platforms instead.
2021-10-02 22:38:02 +01:00
Qi Xiao
ba3dccb625 pkg/sys: Clarify package godocs. 2021-10-02 13:45:47 +01:00
Qi Xiao
67369b6284 pkg/sys/unix: Simplify the handling of Termios differences a bit. 2021-10-02 13:42:27 +01:00
Qi Xiao
f9103bef1a pkg/sys/unix: Remove utilities that are no longer needed. 2021-10-02 13:25:21 +01:00
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