mirror of
https://github.com/openfaas/faas.git
synced 2025-06-09 08:46:48 +00:00
Added os.TempDir() to replace using '/tmp/' to make the tempdir cross platform
Signed-off-by: Franklin Harding <franklinharding0.0@gmail.com>
This commit is contained in:
parent
028803b4a5
commit
6ebc314bdf
@ -5,6 +5,7 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
|
"path/filepath"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"log"
|
"log"
|
||||||
@ -252,13 +253,11 @@ func main() {
|
|||||||
|
|
||||||
http.HandleFunc("/", makeRequestHandler(&config))
|
http.HandleFunc("/", makeRequestHandler(&config))
|
||||||
|
|
||||||
if config.suppressLock == false {
|
path := filepath.Join(os.TempDir(), ".lock")
|
||||||
path := "/tmp/.lock"
|
log.Printf("Writing lock-file to: %s\n", path)
|
||||||
log.Printf("Writing lock-file to: %s\n", path)
|
writeErr := ioutil.WriteFile(path, []byte{}, 0660)
|
||||||
writeErr := ioutil.WriteFile(path, []byte{}, 0660)
|
if writeErr != nil {
|
||||||
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.Panicf("Cannot write %s. To disable lock-file set env suppress_lock=true.\n Error: %s.\n", path, writeErr.Error())
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
log.Fatal(s.ListenAndServe())
|
log.Fatal(s.ListenAndServe())
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user