Skip to content

OSUpdateNotifier: checkAttemptToQuit() function will not quit if input value is empty #37

Description

@phu-ngo

in some case the jamfhelper killed by terminal or Activity Monitor it will not return 239 error code and return empty intend

old code

checkAttemptToQuit(){
    Value="${1}"
    
    # Jamf Helper was exited without making a choice
    if [[ "$Value" == "239" ]]; then
        echo "Jamf Helper was exited without making a choice."
        "$jamf" policy -event "$CustomTriggerNameDeprecationPolicy" &
        exit 0
    fi
}

fix

checkAttemptToQuit(){
    Value="${1}"
    
    # Jamf Helper was exited without making a choice
    # pngo 12/31/21: include empty return code
    # The 239 return value is defaults when user quit the jamfhelper (Command+Q) if user kill it using kill [pid] command it will return empty
    if [[ "$Value" == "239" ]] || [[ -z "$Value" ]]; then
        echo "Jamf Helper was exited without making a choice."
        "$jamf" policy -event "$CustomTriggerNameDeprecationPolicy" &
        exit 0
    fi
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions