Skip to content
Snippets Groups Projects
Commit 6ebc314b authored by Franklin Harding's avatar Franklin Harding Committed by Alex Ellis
Browse files

Added os.TempDir() to replace using '/tmp/' to make the tempdir cross platform

parent 028803b4
No related branches found
No related tags found
No related merge requests found
......@@ -5,6 +5,7 @@ package main
import (
"bytes"
"path/filepath"
"fmt"
"io/ioutil"
"log"
......@@ -252,13 +253,11 @@ func main() {
http.HandleFunc("/", makeRequestHandler(&config))
if config.suppressLock == false {
path := "/tmp/.lock"
log.Printf("Writing lock-file to: %s\n", path)
writeErr := ioutil.WriteFile(path, []byte{}, 0660)
if writeErr != nil {
log.Panicf("Cannot write %s. To disable lock-file set env suppress_lock=true.\n Error: %s.\n", path, writeErr.Error())
}
path := filepath.Join(os.TempDir(), ".lock")
log.Printf("Writing lock-file to: %s\n", path)
writeErr := ioutil.WriteFile(path, []byte{}, 0660)
if writeErr != nil {
log.Panicf("Cannot write %s. To disable lock-file set env suppress_lock=true.\n Error: %s.\n", path, writeErr.Error())
}
log.Fatal(s.ListenAndServe())
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment