Skip to content

Commit

Permalink
feat: automatic setting ulimit
Browse files Browse the repository at this point in the history
  • Loading branch information
sohaha committed Nov 20, 2020
1 parent e3e8d87 commit 43a0b21
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 6 deletions.
1 change: 1 addition & 0 deletions app/watch/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ func StartCmd(watchCmd *cobra.Command) (app *cobra.Command) {
run(cmd)
},
}
util.SetLimit(999999)
watchCmd.AddCommand(app)
return
}
Expand Down
1 change: 1 addition & 0 deletions app/watch/task.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ func (t *taskType) run(cf *changedFile, commands []string, outpuContent bool, ex
}
if err = cmd.Wait(); err != nil {
errMsg := err.Error()

if !strings.Contains(errMsg, "exit status 1") && !strings.Contains(errMsg, "signal: killed") {
util.Log.Println("command End:", err)
}
Expand Down
4 changes: 3 additions & 1 deletion app/watch/util_no_win.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

package watch

import "os"
import (
"os"
)

func sameFile(fi1, fi2 os.FileInfo) bool {
return os.SameFile(fi1, fi2)
Expand Down
2 changes: 2 additions & 0 deletions cmd/stress.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
v "github.com/spf13/viper"

"github.com/sohaha/zzz/app/stress"
"github.com/sohaha/zzz/util"
)

var stressUse = "stress"
Expand Down Expand Up @@ -152,6 +153,7 @@ var stressCmd = &cobra.Command{
}
}

util.SetLimit(999999)
targetRequestStats, err := stress.RunStress(stressCfg, os.Stdout)
if err != nil {
return err
Expand Down
3 changes: 2 additions & 1 deletion cmd/watch.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ import (
"time"

"github.com/sohaha/zlsgo/zfile"
"github.com/spf13/cobra"

"github.com/sohaha/zzz/app/watch"
"github.com/sohaha/zzz/util"
"github.com/spf13/cobra"
)

var (
Expand Down
4 changes: 1 addition & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,5 @@ func main() {
var c = make(chan struct{}, 0)
go cmd.GetNewVersion(c)
cmd.Execute()
select {
case <-c:
}
<-c
}
2 changes: 1 addition & 1 deletion util/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ var (
once sync.Once
installPath string
homePath string
Version = "1.0.25"
Version = "1.0.26"
BuildTime = ""
BuildGoVersion = ""
)
Expand Down

0 comments on commit 43a0b21

Please sign in to comment.