mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-24 01:08:10 +02:00
change the atomic write functions to work with readers
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
package edit_in_kitty
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/base64"
|
||||
"fmt"
|
||||
"io"
|
||||
@@ -212,7 +213,7 @@ func edit_in_kitty(path string, opts *Options) (err error) {
|
||||
add_encoded("file_data", utils.UnsafeBytesToString(file_data))
|
||||
fmt.Println("Waiting for editing to be completed, press Esc to abort...")
|
||||
write_data := func(data_type string, rdata []byte) (err error) {
|
||||
err = utils.AtomicWriteFile(path, rdata, fs.FileMode(s.Mode).Perm())
|
||||
err = utils.AtomicWriteFile(path, bytes.NewReader(rdata), fs.FileMode(s.Mode).Perm())
|
||||
if err != nil {
|
||||
err = fmt.Errorf("Failed to write data to %s with error: %w", path, err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user