#175 fixed
This commit is contained in:
parent
600b1ac467
commit
f0e28d1602
|
@ -1,8 +1,8 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"github.com/tockins/interact"
|
||||
"github.com/tockins/realize/realize"
|
||||
"github.com/oxequa/interact"
|
||||
"github.com/oxequa/realize/realize"
|
||||
"gopkg.in/urfave/cli.v2"
|
||||
"log"
|
||||
"os"
|
||||
|
|
|
@ -26,7 +26,7 @@ var (
|
|||
|
||||
// Watch info
|
||||
type Watch struct {
|
||||
Exts []string `yaml:"exts" json:"exts"`
|
||||
Exts []string `yaml:"extensions" json:"extensions"`
|
||||
Paths []string `yaml:"paths" json:"paths"`
|
||||
Scripts []Command `yaml:"scripts,omitempty" json:"scripts,omitempty"`
|
||||
Hidden bool `yaml:"hidden,omitempty" json:"hidden,omitempty"`
|
||||
|
@ -40,7 +40,7 @@ type Ignore struct{
|
|||
|
||||
// Command fields
|
||||
type Command struct {
|
||||
Cmd string `yaml:"cmd" json:"cmd"`
|
||||
Cmd string `yaml:"command" json:"command"`
|
||||
Type string `yaml:"type" json:"type"`
|
||||
Path string `yaml:"path,omitempty" json:"path,omitempty"`
|
||||
Global bool `yaml:"global,omitempty" json:"global,omitempty"`
|
||||
|
@ -62,7 +62,7 @@ type Project struct {
|
|||
Path string `yaml:"path" json:"path"`
|
||||
Env map[string]string `yaml:"env,omitempty" json:"env,omitempty"`
|
||||
Args []string `yaml:"args,omitempty" json:"args,omitempty"`
|
||||
Tools Tools `yaml:"tools" json:"tools"`
|
||||
Tools Tools `yaml:"commands" json:"commands"`
|
||||
Watcher Watch `yaml:"watcher" json:"watcher"`
|
||||
Buffer Buffer `yaml:"-" json:"buffer"`
|
||||
ErrPattern string `yaml:"pattern,omitempty" json:"pattern,omitempty"`
|
||||
|
@ -196,7 +196,7 @@ func (p *Project) Reload(path string, stop <-chan bool) {
|
|||
}
|
||||
// Go supported tools
|
||||
if len(path) > 0 {
|
||||
fi, err := os.Stat(filepath.Dir(path))
|
||||
fi, err := os.Stat(path)
|
||||
if filepath.Ext(path) == "" {
|
||||
fi, err = os.Stat(path)
|
||||
}
|
||||
|
@ -477,8 +477,8 @@ func (p *Project) cmd(stop <-chan bool, flag string, global bool) {
|
|||
case <-done:
|
||||
return
|
||||
case r := <-result:
|
||||
msg = fmt.Sprintln(p.pname(p.Name, 5), ":", Green.Bold("Command"), Green.Bold("\"")+r.Name+Green.Bold("\""))
|
||||
if r.Err != nil {
|
||||
msg = fmt.Sprintln(p.pname(p.Name, 5), ":", Green.Bold("Command"), Green.Bold("\"")+r.Name+Green.Bold("\""))
|
||||
if r.Err != nil {
|
||||
out = BufferOut{Time: time.Now(), Text: r.Err.Error(), Type: flag}
|
||||
p.stamp("error", out, msg, fmt.Sprint(Red.Regular(r.Err.Error())))
|
||||
} else {
|
||||
|
@ -497,9 +497,9 @@ func (p *Project) walk(path string, info os.FileInfo, err error) error {
|
|||
if p.parent.Settings.Recovery.Index {
|
||||
log.Println("Indexing",path)
|
||||
}
|
||||
p.tools(p.stop, path, info)
|
||||
if info.IsDir() {
|
||||
// tools dir
|
||||
p.tools(p.stop, path, info)
|
||||
p.folders++
|
||||
} else {
|
||||
// tools files
|
||||
|
@ -544,7 +544,7 @@ func (p *Project) stamp(t string, o BufferOut, msg string, stream string) {
|
|||
log.Print(msg)
|
||||
}
|
||||
if stream != "" {
|
||||
fmt.Fprint(Output, stream)
|
||||
fmt.Fprintln(Output, stream)
|
||||
}
|
||||
go func() {
|
||||
p.parent.Sync <- "sync"
|
||||
|
|
|
@ -43,7 +43,7 @@ func (t *Tools) Setup() {
|
|||
if t.Clean.Status {
|
||||
t.Clean.name = "Clean"
|
||||
t.Clean.isTool = true
|
||||
t.Clean.cmd = replace([]string{"go clean"}, t.Clean.Method)
|
||||
t.Clean.cmd = replace([]string{"go", "clean"}, t.Clean.Method)
|
||||
t.Clean.Args = split([]string{}, t.Clean.Args)
|
||||
}
|
||||
// go generate
|
||||
|
@ -134,7 +134,12 @@ func (t *Tool) Exec(path string, stop <-chan bool) (response Response) {
|
|||
cmd.Stdout = &out
|
||||
cmd.Stderr = &stderr
|
||||
// Start command
|
||||
cmd.Start()
|
||||
err := cmd.Start()
|
||||
if err != nil{
|
||||
response.Name = t.name
|
||||
response.Err = err
|
||||
return
|
||||
}
|
||||
go func() { done <- cmd.Wait() }()
|
||||
// Wait a result
|
||||
select {
|
||||
|
@ -145,7 +150,7 @@ func (t *Tool) Exec(path string, stop <-chan bool) (response Response) {
|
|||
// Command completed
|
||||
response.Name = t.name
|
||||
if err != nil {
|
||||
response.Err = errors.New(stderr.String() + out.String())
|
||||
response.Err = errors.New(stderr.String() + out.String() + err.Error())
|
||||
} else {
|
||||
if t.Output {
|
||||
response.Out = out.String()
|
||||
|
|
|
@ -3,7 +3,7 @@ package main
|
|||
import (
|
||||
"bytes"
|
||||
"errors"
|
||||
"github.com/tockins/realize/realize"
|
||||
"github.com/oxequa/realize/realize"
|
||||
"log"
|
||||
"strings"
|
||||
"testing"
|
||||
|
|
Loading…
Reference in New Issue