aboutsummaryrefslogtreecommitdiff
path: root/internal
diff options
context:
space:
mode:
authorishaan <contact@ishaan.cc>2026-08-20 14:07:50 +0530
committerishaan <contact@ishaan.cc>2026-08-20 14:07:50 +0530
commitb60ef6b303c01039107cdf6433642cfb0b337557 (patch)
treebb10c6583e9b7ec9cee987511c74f72e1ec4ba7a /internal
parent7caaf4c96d4f657d9193baf48e9745c9f68181c9 (diff)
implement atomic writes
Diffstat (limited to 'internal')
-rw-r--r--internal/crud/cli_new_pass.go2
-rw-r--r--internal/crud/cli_new_ssh.go2
2 files changed, 2 insertions, 2 deletions
diff --git a/internal/crud/cli_new_pass.go b/internal/crud/cli_new_pass.go
index 2a8c2f4..2b01e13 100644
--- a/internal/crud/cli_new_pass.go
+++ b/internal/crud/cli_new_pass.go
@@ -153,7 +153,7 @@ func NewNotePassEdit(output, editorString string) error {
perm = noteInfo.Mode().Perm()
}
- err = os.WriteFile(output, encrypted, perm)
+ err = utils.WriteFileAtomic(output, encrypted, perm)
fmt.Println("New note saved at:", output)
diff --git a/internal/crud/cli_new_ssh.go b/internal/crud/cli_new_ssh.go
index 2a69223..797e769 100644
--- a/internal/crud/cli_new_ssh.go
+++ b/internal/crud/cli_new_ssh.go
@@ -226,7 +226,7 @@ func NewNoteSSHEdit(output string, defaultPubKeyBytes []byte, defaultPrivKeyPath
perm = noteInfo.Mode().Perm()
}
- err = os.WriteFile(output, encrypted, perm)
+ err = utils.WriteFileAtomic(output, encrypted, perm)
fmt.Println("New note saved at:", output)