Sha256: 7cea35119a8c74d29ed107b5ce8a1fc9e2cb34f6b58197f8f7c30aa04b1b0c9e

Contents?: true

Size: 941 Bytes

Versions: 4

Compression:

Stored size: 941 Bytes

Contents

# frozen_string_literal: true

# takelage mutagen socket terminate
module MutagenSocketTerminate
  # Backend method for mutagen socket terminate.
  def mutagen_socket_terminate(socket)
    log.debug "Terminate the mutagen socket \"#{socket}\""

    socket_terminated = _mutagen_socket_terminate_socket socket

    cmd_remove = config.active['cmd_mutagen_forward_socket_remove']
    docker_container_command cmd_remove if cmd_remove && socket_terminated.exitstatus.zero?

    unless socket_terminated.exitstatus.zero?
      log.debug "Unable to terminated mutagen socket \"#{socket}\""
      return false
    end

    log.debug "Terminated the mutagen socket \"#{socket}\""
    true
  end

  private

  # Get git branch.
  def _mutagen_socket_terminate_socket(socketname)
    cmd_terminate_socket = format(
      config.active['cmd_mutagen_forward_socket_terminate'],
      socketname: socketname
    )
    try cmd_terminate_socket
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
takelage-0.28.11 lib/takelage/mutagen/socket/terminate.rb
takelage-0.28.8 lib/takelage/mutagen/socket/terminate.rb
takelage-0.28.7 lib/takelage/mutagen/socket/terminate.rb
takelage-0.28.5 lib/takelage/mutagen/socket/terminate.rb