Forbid the serve command to work on a non-existent directory

git-svn-id: file:///srv/svn/repo/aya/trunk@92 cec141ff-132a-4243-88a5-ce187bd62f94
This commit is contained in:
yakumo.izuru
2025-06-29 01:51:57 +00:00
parent 28ce3606b9
commit 06c94dfc19
3 changed files with 8 additions and 3 deletions

View File

@@ -6,7 +6,7 @@ BINDIR ?= ${PREFIX}/bin
MANDIR ?= ${PREFIX}/man MANDIR ?= ${PREFIX}/man
DATE ?= `date -u +%F` DATE ?= `date -u +%F`
GOOS ?= `${GO} env GOOS` GOOS ?= `${GO} env GOOS`
VERSION ?= 1.0G+${REV} VERSION ?= 1.0H+${REV}
REV ?= `svn info --show-item revision || git rev-list --all | wc -l` REV ?= `svn info --show-item revision || git rev-list --all | wc -l`
build: build:
${GO} build ${GOFLAGS} ./cmd/aya ${GO} build ${GOFLAGS} ./cmd/aya

View File

@@ -38,7 +38,7 @@ func buildAll(watch bool) {
run(vars, "prehook") run(vars, "prehook")
modified = true modified = true
} }
fmt.Println("GEN", path) fmt.Println(path)
return build(path, nil, vars) return build(path, nil, vars)
} }
return nil return nil

View File

@@ -50,7 +50,12 @@ func main() {
case "help": case "help":
aya.PrintUsage() aya.PrintUsage()
case "serve": case "serve":
aya.HttpServe(PUBDIR, 8000) d, err := os.Stat(PUBDIR)
if err != nil {
log.Fatal("[aya.HttpServe] I see, you want me to serve a non-existent directory, huh?")
} else {
aya.HttpServe(fmt.Sprint(d), 8000)
}
case "var": case "var":
if len(args) == 0 { if len(args) == 0 {
log.Fatal("[var] Filename expected") log.Fatal("[var] Filename expected")