Repository navigation
Harvest upstream fixes and small features - #1
Merged
Merged
Conversation
printMsg checked the global reflexID (always >= 0) instead of the message's id, so [info] lines never got the intended red color.
A service whose command failed to start left running=true with a nil cmd.Process, so the next restart panicked in terminate (cespare#105). Failed starts now leave a clean state. Also fixes three related problems: - terminate marks the reflex not running and tolerates nil tty/cmd. - killed is reset for each run; previously it stayed true forever, which suppressed '(error exit: ...)' messages after the first restart. - a failed start no longer waits on a done signal that never arrives (deadlocking non-service commands) and releases the --sequential lock. Each run now has its own done channel, closed when the process exits, so a stale completion can never be mistaken for the current one.
The change happens before the config file is read and before watching starts, so relative paths in both are resolved from the new directory. An invalid directory is a fatal error. Based on cespare#88.
Reflex ignores events whose only operation is Chmod. The new global flag opts into them. Based on cespare#33 (fixes cespare#32).
A command can be given a name, which is used in the decoration tag
instead of the numeric id. This makes the output of multi-service config
files much easier to follow:
[web] listening on :8080
[worker] processing job 42
Based on cespare#94.
Config lines now accept -d/--decoration. Decoration is process-wide, so all lines must agree (case-insensitively); a value on the command line wins. This fixes the 'unknown flag: --decoration' error from cespare#108.
Replace filepath.Match with doublestar.Match so that ** matches any number of path segments (e.g. -g '**/*.go').
Only load the default config file when reflex is invoked without a command and without per-command flags, so that commands such as 'reflex -r x make' keep working in a directory that has a reflex.conf.
Tighten the harvest branch after review: - Report accurately which flags may accompany --config. - Only chdir when --directory is given, and extract config path resolution so the auto-reflex.conf rules are testable. - Rename the chmods global to flagChmods for consistency. - Stop the terminate timer when the command exits. - Handle runCommand errors explicitly in runEach and Start. - Remove the unused (*Reflex).infoPrintf method. - Build each decorated line once and write it in a single call. - Clarify the --decoration and --clear documentation.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Harvests the useful work from upstream
cespare/reflex(no merges there since v0.3.2) and fixes several bugs found while reviewing it. One commit per item.Fixes
terminateno longer panics on a nilProcess; a failed start clearsrunning, releases the--sequentiallock, and a non-service command no longer deadlocks waiting for a completion that never arrives.killedis now per-run, so later error output is not suppressed.printMsgused the globalreflexIDinstead of the message's ID.terminateerror check — replaced an uncheckederr.(syscall.Errno)assertion witherrors.Is.Features
-D/--directory— chdir before reading config and watching (upstream Set working directory cespare/reflex#88).-m/--chmods— react to chmod-only events (upstream Added global flag for watching chmod only changes cespare/reflex#33, issue HandlingChmodseems to be needed when using dinghy cespare/reflex#32).--name— readable[web]output tags instead of[00](upstream feat: set command name explicitly and use it instead of the sequence number in the output cespare/reflex#94, issue Enforce group naming or Apply alias cespare/reflex#91).--decorationin config files — command line wins, conflicting values error (issue Can't set decoration using config file cespare/reflex#108).**globs — viabmatcuk/doublestar/v4;-g '**/*.go'matches nested files (upstream Use doublestar for glob matching cespare/reflex#55, ported to v4).reflex.conf— only when no command and no per-command flags are given, soreflex -r '\.go$' makeis unaffected (upstream Use default config file if exists cespare/reflex#68, issue Use a default config filename cespare/reflex#41).--clear— erase the screen before each command run (issue Clear screen before re running a command. cespare/reflex#65).Deliberately not applied
f.Mode()before checking the walk error (nil deref), walks the resolved target so reported paths stop matching patterns, and has no cycle detection. Resolving watch roots is the safe follow-up.Testing
go test ./...,go vet ./...,staticcheck ./...clean.go test -racepasses.killedreset, output tags, clear-screen output, decoration conflicts,**matching, and auto-config resolution.golangci-lintreports only 4 pre-existing findings.-D,-m,--clear,--name, config decoration, and auto-reflex.confbehavior.