1
1
mirror of https://github.com/walles/moar.git synced 2024-09-11 20:17:13 +03:00
Commit Graph

32 Commits

Author SHA1 Message Date
Johan Walles
46b84fb392 Add a Windows executable to the release 2021-09-10 06:50:44 +02:00
Johan Walles
78ab63273a Move some test-only code into *_test.go files 2021-05-08 10:32:04 +02:00
Johan Walles
7c553891f7 Fix a progress message 2021-04-27 07:05:52 +02:00
Johan Walles
60b59c2483 Only install linters when needed
This makes most runs of ./test.sh quicker since they don't need to
invoke "go install".
2021-04-23 18:38:40 +02:00
Johan Walles
d51cd89e40 Remove not-needed-any-more check
Since we're getting our linters through "go install".
2021-04-22 19:20:27 +02:00
Johan Walles
0a6db4974b Experiment with go mod tidy and go install
Try to work out #48.
2021-04-22 19:13:12 +02:00
Johan Walles
d24acdbf32 CI logs cosmetics 2021-04-21 08:32:31 +02:00
Johan Walles
34299c42a2 Fix modules modification check 2021-04-21 08:24:55 +02:00
Johan Walles
97f5233080 Verify linters are listed in go.mod 2021-04-21 06:54:49 +02:00
Johan Walles
54942cf12e Less compatibility improvement
If we get both a filename and a pipe, prefer the filename.

For example, this will show the contents of /etc/passwd:

$ echo hello | moar /etc/passwd

Before this change, it displayed "hello" on a page.
2021-04-20 09:18:02 +02:00
Johan Walles
730ed46f4f Fix errcheck reported problems 2021-04-20 08:43:37 +02:00
Johan Walles
c93270e8fc Run errcheck from test.sh 2021-04-20 06:59:49 +02:00
Johan Walles
c3936b44f4 Run staticcheck from test.sh 2021-04-20 06:46:14 +02:00
Johan Walles
592d6da1dc Fix a docs error 2021-04-19 15:30:09 +02:00
Johan Walles
ccfe3d3b20 Run "go vet" as part of testing 2021-04-19 15:29:28 +02:00
Johan Walles
d122901ca8 Add gomft -s flag
Adds code simplifications. Recommended online somewhere.
2021-04-19 15:20:33 +02:00
Johan Walles
40c7a473c9 Run all tests in the source tree
Changed from "run all tests in github.com/walles/moar/m"
2021-04-19 08:41:09 +02:00
Johan Walles
ede1a8cbb3 Verify code formatting in ./test.sh 2021-04-19 08:41:09 +02:00
Johan Walles
90e374601d Use our new tcell replacement 2021-04-17 22:29:41 +02:00
Johan Walles
1ac14b1c23 Fix private-functions naming
It's start-with-lowercase, not start-with-underscore.
2020-12-29 17:08:54 +01:00
Johan Walles
08db9e9cd6 Stop creating our own low-numbered colors
Because it didn't work.
2020-12-06 21:37:00 +01:00
Johan Walles
08d3fbfaa8 Add some timeouts
diff --git m/reader.go m/reader.go
index 339de9c..2427094 100644
--- m/reader.go
+++ m/reader.go
@@ -12,6 +12,7 @@ import (
 	"regexp"
 	"strings"
 	"sync"
+	"time"
 )

 // Reader reads a file into an array of strings.
@@ -54,9 +55,18 @@ func _ReadStream(stream io.Reader, reader *Reader, fromFilter *exec.Cmd) {
 			return
 		}

-		// FIXME: Can Wait()ing here stall? Should we release the lock while Wait()ing?
+		// Give the filter a little time to go away
+		timer := time.AfterFunc(2*time.Second, func() {
+			fromFilter.Process.Kill()
+		})
+
 		err := fromFilter.Wait()
+		timer.Stop()
+
 		if reader.err == nil {
+			// NOTE: This could mean that our Wait()ing on the filter above
+			// timed out.
+			//
 			// FIXME: Add filter stderr contents to the error reported here
 			reader.err = err
 		}
diff --git test.sh test.sh
index 677c5db..6d0b6b9 100755
--- test.sh
+++ test.sh
@@ -3,7 +3,7 @@
 set -e -o pipefail

 # Unit tests first
-go test github.com/walles/moar/m
+go test -timeout 20s github.com/walles/moar/m

 # Ensure we can cross compile
 # NOTE: Make sure this list matches the one in release.sh

Change-Id: I3847aaa0942588c2d4129c7b2967d1d10aa95035
2019-11-19 15:08:22 +01:00
Johan Walles
bc4bae3625 Add a script for making new releases 2019-08-04 19:07:14 +02:00
Johan Walles
d2e94fd26c Take control of --help output 2019-07-15 22:14:36 +02:00
Johan Walles
31ae7927c7 Print bug reporting instructions on panics 2019-07-08 06:42:48 +02:00
Johan Walles
0fbb2ce8d3 Write version number into executable 2019-07-07 18:35:55 +02:00
Johan Walles
84ae2cb21c Add --version tests
They fail.
2019-07-07 18:23:57 +02:00
Johan Walles
2f5c2da2e3 Case insensitive search on lowercase-only pattern 2019-07-06 22:16:08 +02:00
Johan Walles
da30eaf956 Handle displaying empty files
And introduce a unit test!
2019-06-13 20:04:51 +02:00
Johan Walles
af23822bc2 Put integration tests in tests.sh
This makes the testing code a bit simpler.
2019-06-09 22:03:25 +02:00
Johan Walles
c88da93eb6 Support copying from file to redirected stdout 2019-06-09 19:55:49 +02:00
Johan Walles
680045fbc1 Add initial integration tests 2019-06-09 18:42:25 +02:00