Parcourir la source

References #147. Sudo loop is off by default

Jguer il y a 7 ans
Parent
commit
9f734bdf8d
2 fichiers modifiés avec 7 ajouts et 2 suppressions
  1. 5 2
      cmd.go
  2. 2 0
      config.go

+ 5 - 2
cmd.go

@@ -291,7 +291,7 @@ func handleCmd() (err error) {
 		}
 	}
 
-	if cmdArgs.needRoot() {
+	if config.SudoLoop == true && cmdArgs.needRoot() {
 		go sudoLoop()
 	}
 
@@ -655,7 +655,10 @@ func numberMenu(pkgS []string, flags []string) (err error) {
 	aurI = removeListFromList(aurNI, aurI)
 	repoI = removeListFromList(repoNI, repoI)
 
-	go sudoLoop()
+	if config.SudoLoop == true {
+		go sudoLoop()
+	}
+
 	arguments := makeArguments()
 	arguments.addTarget(repoI...)
 	arguments.addTarget(aurI...)

+ 2 - 0
config.go

@@ -33,6 +33,7 @@ type Configuration struct {
 	RequestSplitN int    `json:"requestsplitn"`
 	SearchMode    int    `json:"-"`
 	SortMode      int    `json:"sortmode"`
+	SudoLoop      bool   `json:"sudoloop"`
 	TimeUpdate    bool   `json:"timeupdate"`
 	NoConfirm     bool   `json:"noconfirm"`
 	Devel         bool   `json:"devel"`
@@ -109,6 +110,7 @@ func defaultSettings(config *Configuration) {
 	config.PacmanBin = "/usr/bin/pacman"
 	config.PacmanConf = "/etc/pacman.conf"
 	config.SortMode = BottomUp
+	config.SudoLoop = false
 	config.TarBin = "/usr/bin/bsdtar"
 	config.TimeUpdate = false
 	config.RequestSplitN = 150