Explorar o código

Fix error when /proc/version is missing

Tim Byrne %!s(int64=5) %!d(string=hai) anos
pai
achega
79e93e38bc
Modificáronse 1 ficheiros con 3 adicións e 1 borrados
  1. 3 1
      yadm

+ 3 - 1
yadm

@@ -1535,7 +1535,9 @@ function configure_repo() {
 
 
 function set_operating_system() {
 function set_operating_system() {
 
 
-  if [[ "$(<"$PROC_VERSION")" =~ [Mm]icrosoft ]]; then
+  local proc_version
+  proc_version=$(cat "$PROC_VERSION" 2>/dev/null)
+  if [[ "$proc_version" =~ [Mm]icrosoft ]]; then
     OPERATING_SYSTEM="WSL"
     OPERATING_SYSTEM="WSL"
   else
   else
     OPERATING_SYSTEM=$(uname -s)
     OPERATING_SYSTEM=$(uname -s)