Skip to content

Commit

Permalink
Merge pull request #51 from spryker-middleware/bugfix/sm-203-json-row…
Browse files Browse the repository at this point in the history
…-write-stream-throws-exception-if-theres-nothing-to-write

SM-203: Truncate file only when its size more than zero
  • Loading branch information
dereuromark authored Jun 19, 2019
2 parents 9f35a7b + 74e9738 commit 569954b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
14 changes: 6 additions & 8 deletions .scrutinizer.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
build:
dependencies:
before:
- composer config repositories.spryker composer https://code.spryker.com/repo/private
environment:
php:
version: 7.1
php: '7.1'

checks:
php:
code_rating: true
nodes:
analysis:
tests:
override:
- php-scrutinizer-run

filter:
excluded_paths:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,10 @@ public function close(): bool
if ($this->handle) {
$this->flush();
$stat = fstat($this->handle);
ftruncate($this->handle, $stat[static::KEY_SIZE] - 1);

if ($stat[static::KEY_SIZE] > 0) {
ftruncate($this->handle, $stat[static::KEY_SIZE] - 1);
}

return fclose($this->handle);
}
Expand Down

0 comments on commit 569954b

Please sign in to comment.