adding new attribute lock (#8)

This commit is contained in:
Julien Neuhart
2018-05-16 12:06:30 +02:00
committed by GitHub
parent 5100693789
commit e3366d0b62
16 changed files with 97 additions and 2 deletions

View File

@@ -33,8 +33,12 @@ func (e *commandTimeoutError) Error() string {
// run runs the given command. If timeout is reached or
// something bad happened, returns an error.
func (r *runner) run(command string, interpreter []string, timeout int) error {
r.mu.Lock()
defer r.mu.Unlock()
if config.HasLock() {
r.mu.Lock()
defer r.mu.Unlock()
} else {
logger.Warn("lock disabled")
}
binary := interpreter[0]
parameters := append(interpreter[1:], command)