Save will actually write to disk now

pull/13/head
Chris Bednarski 9 years ago
parent 5f7587e540
commit d0930958bf

@ -164,6 +164,13 @@ func (h *Hostfile) Format() []byte {
// Save writes the Hostfile to disk to /etc/hosts or to the location specified
// by the HOSTESS_PATH environment variable (if set).
func (h *Hostfile) Save() error {
// h.Format(h.Path)
return nil
file, err := os.OpenFile(h.Path, os.O_RDWR|os.O_APPEND|os.O_TRUNC, 0644)
if err != nil {
return err
}
defer file.Close()
_, err = file.Write(h.Format())
return err
}

Loading…
Cancel
Save