Changeset - 9bf3870befd3
[Not reviewed]
0 1 0
Branko Majic (branko) - 4 years ago 2020-07-06 17:07:18
branko@majic.rs
Noticket: [factorio_manager.sh] Disable a couple of false positives from shellcheck, and do not use $? when checking flock's exit code.
1 file changed with 6 insertions and 2 deletions:
0 comments (0 inline, 0 general) First comment
games/factorio_manager.sh
Show inline comments
 
@@ -406,6 +406,9 @@ function colorprintf() {
 
    local format="$2"
 
    shift 2
 

	
 
    # Variables within this printf are used for dynamic color and
 
    # formatting, and can't be used as arguments.
 
    # shellcheck disable=SC2059
 
    printf "${_text_colors[$color]}${format}${reset}" "$@"
 
}
 

	
 
@@ -1145,8 +1148,7 @@ function lock() {
 

	
 
    # Obtain lock - Factorio uses the same mechanism, so we should
 
    # be able to detect the game is running in this way.
 
    flock --exclusive --nonblock "$fd"
 
    if [[ $? != 0 ]]; then
 
    if ! flock --exclusive --nonblock "$fd"; then
 
        error "Could not acquire lock via lock file '$lock_file'. Is Factorio still running?"
 
        exit "$ERROR_GENERAL"
 
    fi
 
@@ -1280,6 +1282,7 @@ elif [[ $command == list ]]; then
 
        if [[ -f $candidate/instance.conf ]]; then
 
            # shellcheck source=/dev/null
 
            source "$candidate/instance.conf"
 
            # shellcheck disable=SC2154 # game_version is read from the configuration file
 
            echo "  - $(basename "$candidate") ($game_version)"
 
        fi
 
    done
 
@@ -1883,6 +1886,7 @@ elif [[ $command == info ]]; then
 
        # single-quoted, and that $ expansions are actually done
 
        # internally in jq itself. Query accepts two vars - mod_name
 
        # and enable_new_mods.
 
        # shellcheck disable=SC2016 # The $enable_new_mods is meant to be interpreted by jq, not bash.
 
        jq_is_enabled_query='.mods | map(select(.name==$mod_name))[0] // {"name": "default", "enabled": $enable_new_mods} | .enabled'
 

	
 
        # Process every mod found.
0 comments (0 inline, 0 general) First comment
You need to be logged in to comment. Login now