From 208aa1ad7f153974e12b7323442690d166d9b10a Mon Sep 17 00:00:00 2001 From: Valentin Lab Date: Fri, 7 Dec 2018 09:07:00 +0100 Subject: [PATCH] new: dev: small refactor of ``file_get_hash`` !minor --- bin/compose-core | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/bin/compose-core b/bin/compose-core index 952d91f..0cb41b5 100755 --- a/bin/compose-core +++ b/bin/compose-core @@ -2241,12 +2241,18 @@ clean_unused_docker_compose() { export -f clean_unused_docker_compose -file_get_hash() { - local file="$1" sha - sha=$(sha256sum "$file") +stdin_get_hash() { + local sha + sha=$(sha256sum) || return 1 sha=${sha:0:64} echo "$sha" } +export -f stdin_get_hash + + +file_get_hash() { + stdin_get_hash < "$1" || return 1 +} export -f file_get_hash