discourse/lib/file_store
David Taylor 1998be3b27
DEV: Raise errors when cleaning the download cache, and fix for macOS (#8319)
POSIX's `head` specification states: "The application shall ensure that the number option-argument is a positive decimal integer"

Negative values are supported on GNU `head`, so this works in the discourse docker image. However, in some environments (e.g. macOS), the system `head` version fails with a negative `n` parameter.

This commit does two things:

Checks the status at each stage of the pipe, so it cannot fail silently
Flip the `ls` command to list in descending time order, and use `tail -n +501` instead of `head -n -500`.

The visible result is that macOS users no longer see head: illegal line count -- -500 printed throughout the test suite.
2019-11-08 15:34:03 +00:00
..
base_store.rb DEV: Raise errors when cleaning the download cache, and fix for macOS (#8319) 2019-11-08 15:34:03 +00:00
local_store.rb DEV: enable frozen string literal on all files 2019-05-13 09:31:32 +08:00
s3_store.rb DEV: pluck_first 2019-10-21 12:08:20 +01:00