mirror of
https://github.com/schollz/croc.git
synced 2025-10-11 13:21:00 +02:00
add error handling
This commit is contained in:
parent
bc9dbfd905
commit
90ed1f797e
1 changed files with 7 additions and 1 deletions
|
@ -1737,6 +1737,9 @@ func (c *Client) createEmptyFileAndFinish(fileInfo FileInfo, i int) (err error)
|
||||||
description = " " + description
|
description = " " + description
|
||||||
}
|
}
|
||||||
width, _, err := term.GetSize(int(os.Stdout.Fd()))
|
width, _, err := term.GetSize(int(os.Stdout.Fd()))
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
if len(description) > width {
|
if len(description) > width {
|
||||||
description = description[:(width-3)] + "..."
|
description = description[:(width-3)] + "..."
|
||||||
}
|
}
|
||||||
|
@ -1916,7 +1919,10 @@ func (c *Client) setBar() {
|
||||||
} else if !c.Options.IsSender {
|
} else if !c.Options.IsSender {
|
||||||
description = " " + description
|
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)
|
description = strings.TrimSpace(description)
|
||||||
if len(description) > width {
|
if len(description) > width {
|
||||||
description = description[:(width-3)] + "..."
|
description = description[:(width-3)] + "..."
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue