Skip to content

Commit

Permalink
Merge pull request #24 from josegonzalez/master
Browse files Browse the repository at this point in the history
Release 0.9.1
  • Loading branch information
josegonzalez authored Oct 6, 2020
2 parents f1aa470 + 8976e32 commit 1f6dbe4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ MAINTAINER_NAME = Jose Diaz-Gonzalez
REPOSITORY = go-procfile-util
HARDWARE = $(shell uname -m)
SYSTEM_NAME = $(shell uname -s | tr '[:upper:]' '[:lower:]')
BASE_VERSION ?= 0.9.0
BASE_VERSION ?= 0.9.1
IMAGE_NAME ?= $(MAINTAINER)/$(REPOSITORY)
PACKAGECLOUD_REPOSITORY ?= dokku/dokku-betafish

Expand Down
8 changes: 8 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,8 @@ func writeProcfile(path string, delimiter string, entries []procfileEntry) error
func parseProcfile(path string, delimiter string) ([]procfileEntry, error) {
var entries []procfileEntry
reCmd, _ := regexp.Compile(`^([a-z0-9]([-a-z0-9]*[a-z0-9])?)` + delimiter + `\s*(.+)$`)
reOldCmd, _ := regexp.Compile(`^([A-Za-z0-9_-]+)` + delimiter + `\s*(.+)$`)

reComment, _ := regexp.Compile(`^(.*)\s#.+$`)

text, err := getProcfile(path)
Expand All @@ -163,14 +165,20 @@ func parseProcfile(path string, delimiter string) ([]procfileEntry, error) {
continue
}

oldParams := reOldCmd.FindStringSubmatch(line)
params := reCmd.FindStringSubmatch(line)
isCommand := len(params) == 4
isOldCommand := len(oldParams) == 3
isComment := strings.HasPrefix(line, "#")
if isComment {
continue
}

if !isCommand {
if isOldCommand {
return entries, fmt.Errorf("process name contains invalid characters, line %d", lineNumber)
}

return entries, fmt.Errorf("invalid line in procfile, line %d", lineNumber)
}

Expand Down

0 comments on commit 1f6dbe4

Please sign in to comment.