Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fix influxdata#6070 on windows
  • Loading branch information
mei-rune committed Aug 1, 2016
1 parent cac6765 commit c501f9d
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions cmd/influx/cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,15 +168,20 @@ func (c *CommandLine) Run() error {
c.Version()

// Only load/write history if HOME environment variable is set.
if homeDir := os.Getenv("HOME"); homeDir != "" {
// Attempt to load the history file.
c.historyFilePath = filepath.Join(homeDir, ".influx_history")
if historyFile, err := os.Open(c.historyFilePath); err == nil {
c.Line.ReadHistory(historyFile)
historyFile.Close()
homeDir := os.Getenv("HOME")
if homeDir == "" {
if homeDir = os.Getenv("HOMEPATH"); homeDir == "" {
homeDir = "~"
}
}

// Attempt to load the history file.
c.historyFilePath = filepath.Join(homeDir, ".influx_history")
if historyFile, err := os.Open(c.historyFilePath); err == nil {
c.Line.ReadHistory(historyFile)
historyFile.Close()
}

// read from prompt until exit is run
return c.mainLoop()
}
Expand Down

0 comments on commit c501f9d

Please sign in to comment.