Skip to content

Commit

Permalink
use tmp naming in cat
Browse files Browse the repository at this point in the history
  • Loading branch information
kkga committed Sep 15, 2021
1 parent 31b3e2a commit edce0af
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions cmd/cat.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ type CatCmd struct {
}

func (c *CatCmd) Run() error {
f, err := os.CreateTemp("", "kks-tmp")
tmp, err := os.CreateTemp("", "kks-tmp")
if err != nil {
return err
}

ch := make(chan string)
go kak.ReadTmp(f, ch)
go kak.ReadTmp(tmp, ch)

sendCmd := fmt.Sprintf("write -force %s", f.Name())
sendCmd := fmt.Sprintf("write -force %s", tmp.Name())

if err := kak.Send(c.kakContext, sendCmd); err != nil {
return err
Expand All @@ -46,8 +46,8 @@ func (c *CatCmd) Run() error {

fmt.Print(output)

f.Close()
os.Remove(f.Name())
tmp.Close()
os.Remove(tmp.Name())

return nil
}

0 comments on commit edce0af

Please sign in to comment.