| 122 | } |
| 123 | |
| 124 | func (wf wrappedFile) Truncate() error { |
| 125 | if wf.withSudo { |
| 126 | // we don't need to stop the screen here, since it is still stopped |
| 127 | // by openFile() |
| 128 | // truncate might not be available on every platfom, so use dd instead |
| 129 | cmd := exec.Command(config.GlobalSettings["sucmd"].(string), "dd", "count=0", "of="+wf.name) |
| 130 | return cmd.Run() |
| 131 | } |
| 132 | return wf.writeCloser.(*os.File).Truncate(0) |
| 133 | } |
| 134 | |
| 135 | func (wf wrappedFile) Write(b *SharedBuffer) (int, error) { |
| 136 | file := bufio.NewWriter(transform.NewWriter(wf.writeCloser, b.encoding.NewEncoder())) |