mirror of
https://github.com/fluencelabs/tendermint
synced 2025-05-09 13:25:04 +00:00
Add Tempdir
This commit is contained in:
parent
890e240730
commit
f40b1b65f8
13
os.go
13
os.go
@ -113,6 +113,19 @@ func Tempfile(prefix string) (*os.File, string) {
|
|||||||
return file, file.Name()
|
return file, file.Name()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func Tempdir(prefix string) (*os.File, string) {
|
||||||
|
tempDir := os.TempDir() + "/" + prefix + RandStr(12)
|
||||||
|
err := EnsureDir(tempDir, 0700)
|
||||||
|
if err != nil {
|
||||||
|
panic(Fmt("Error creating temp dir: %v", err))
|
||||||
|
}
|
||||||
|
dir, err := os.Open(tempDir)
|
||||||
|
if err != nil {
|
||||||
|
panic(Fmt("Error opening temp dir: %v", err))
|
||||||
|
}
|
||||||
|
return dir, tempDir
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------
|
||||||
|
|
||||||
func Prompt(prompt string, defaultValue string) (string, error) {
|
func Prompt(prompt string, defaultValue string) (string, error) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user