diff options
author | Luka Markušić <luka.markusic@microblink.com> | 2022-08-03 07:51:13 +0200 |
---|---|---|
committer | Luka Markušić <luka.markusic@microblink.com> | 2022-08-03 07:55:51 +0200 |
commit | d56bb0b8ef0d9f3289e6e47288d79ed4d84088b0 (patch) | |
tree | 0912c18e40143eaf37b68b01ddd6623bf292be8f /pkg | |
parent | d238d8952ba5e64d15f4cfbb4295aa76da38e835 (diff) |
Fix the integration test
Diffstat (limited to 'pkg')
-rw-r--r-- | pkg/commands/oscommands/os.go | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/pkg/commands/oscommands/os.go b/pkg/commands/oscommands/os.go index 3a42d09db..5f89f976f 100644 --- a/pkg/commands/oscommands/os.go +++ b/pkg/commands/oscommands/os.go @@ -120,10 +120,12 @@ func (c *OSCommand) AppendLineToFile(filename, line string) error { return utils.WrapError(err) } - // read last char buf := make([]byte, 1) - if _, err := f.ReadAt(buf, info.Size()-1); err != nil { - return utils.WrapError(err) + if info.Size() > 0 { + // read last char + if _, err := f.ReadAt(buf, info.Size()-1); err != nil { + return utils.WrapError(err) + } } // if the last byte of the file is not a newline, add it |