Commit 920fe0a4 authored by ale's avatar ale
Browse files

Set nice level 10 by default

parent b35324a5
......@@ -16,14 +16,15 @@ import (
type Shell struct {
dryRun bool
niceLevel int
ioniceClass string
ioniceClass int
}
// NewShell creates a new Shell.
func NewShell(dryRun bool) *Shell {
return &Shell{
dryRun: dryRun,
ioniceClass: "2",
niceLevel: 10,
ioniceClass: 2,
}
}
......@@ -33,8 +34,8 @@ func (s *Shell) SetNiceLevel(n int) {
}
// SetIOClass sets the ionice(1) i/o class.
func (s *Shell) SetIOClass(c string) {
s.ioniceClass = c
func (s *Shell) SetIOClass(n int) {
s.ioniceClass = n
}
func (s *Shell) command(ctx context.Context, arg string) *exec.Cmd {
......@@ -53,9 +54,9 @@ func (s *Shell) command(ctx context.Context, arg string) *exec.Cmd {
args...,
)
}
if s.ioniceClass != "" {
if s.ioniceClass != 0 {
args = append(
[]string{"/usr/bin/ionice", "-c", s.ioniceClass},
[]string{"/usr/bin/ionice", "-c", strconv.Itoa(s.ioniceClass)},
args...,
)
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment