1
0
mirror of https://github.com/schollz/croc.git synced 2024-11-23 15:44:16 +03:00

add error handling

This commit is contained in:
Asuka Minato 2024-08-31 00:23:21 +09:00
parent bc9dbfd905
commit 90ed1f797e

View File

@ -1737,6 +1737,9 @@ func (c *Client) createEmptyFileAndFinish(fileInfo FileInfo, i int) (err error)
description = " " + description
}
width, _, err := term.GetSize(int(os.Stdout.Fd()))
if err != nil {
return
}
if len(description) > width {
description = description[:(width-3)] + "..."
}
@ -1916,7 +1919,10 @@ func (c *Client) setBar() {
} else if !c.Options.IsSender {
description = " " + description
}
width, _, _ := term.GetSize(int(os.Stdout.Fd()))
width, _, err := term.GetSize(int(os.Stdout.Fd()))
if err != nil {
return
}
description = strings.TrimSpace(description)
if len(description) > width {
description = description[:(width-3)] + "..."