Skip to content
This repository has been archived by the owner on Feb 24, 2024. It is now read-only.

Commit

Permalink
dev mode on non-buffalo project results in panic closes #91
Browse files Browse the repository at this point in the history
  • Loading branch information
markbates committed Jan 6, 2017
1 parent e7e0866 commit d9a1a52
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions buffalo/cmd/dev.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package cmd

import (
"context"
"fmt"
"html/template"
"log"
"os"
Expand All @@ -33,6 +34,16 @@ var devCmd = &cobra.Command{
This includes rebuilding your application when files change.
This behavior can be changed in your .buffalo.dev.yml file.`,
Run: func(c *cobra.Command, args []string) {
defer func() {
msg := "There was a problem starting the dev server: %s\n"
cause := "Unknown"
if r := recover(); r != nil {
if err, ok := r.(error); ok {
cause = err.Error()
}
}
fmt.Printf(msg, cause)
}()
os.Setenv("GO_ENV", "development")
ctx := context.Background()
ctx, cancelFunc := context.WithCancel(ctx)
Expand Down Expand Up @@ -78,6 +89,9 @@ func startDevServer(ctx context.Context) error {
return err
}
t, err := template.New("").Parse(nRefresh)
if err != nil {
return err
}
err = t.Execute(f, map[string]interface{}{
"name": "buffalo",
})
Expand Down

0 comments on commit d9a1a52

Please sign in to comment.