Class: Mingle::Io::Stream::MinglePeer

Inherits:
BitGirder::Core::BitGirderClass show all
Includes:
Mingle
Defined in:
lib/mingle/io/stream.rb

Constant Summary

Constants included from Mingle

COMPARABLE_TYPES, Mingle::ID_STYLES, Mingle::ID_STYLE_LC_CAMEL_CAPPED, Mingle::ID_STYLE_LC_HYPHENATED, Mingle::ID_STYLE_LC_UNDERSCORE, Mingle::INT_TYPES, NUM_TYPES, PARSED_TYPES, QNAME_RESOLV_MAP, USE_ICONV

Constants included from BitGirder::Core::BitGirderMethods

BitGirder::Core::BitGirderMethods::PARAM_TYPE_ARG, BitGirder::Core::BitGirderMethods::PARAM_TYPE_ENVVAR, BitGirder::Core::BitGirderMethods::PARAM_TYPE_KEY

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Mingle

cast_value, quote_value

Methods included from BitGirder::Core::BitGirderMethods

argv_to_argh, check_fail_prefix, class_name_to_sym, code, compares_to, console, ext_to_class_name, ext_to_sym, has_env, has_key, has_keys, nonnegative, not_nil, positive, raisef, set_from_key, set_var, split_argv, sym_to_cli_switch, sym_to_ext_id, to_bool, unpack_argv_array, unpack_argv_hash, warn

Methods included from BitGirder::Core::BitGirderStructure

#==, included

Class Method Details

.open(*argv) ⇒ Object



131
132
133
134
135
136
137
# File 'lib/mingle/io/stream.rb', line 131

def self.open( *argv )
    
    res = self.send( :new, *argv )
    res.send( :start )

    res
end

Instance Method Details

#await_exit(opts = { :expect_success => true }) ⇒ Object



109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
# File 'lib/mingle/io/stream.rb', line 109

def await_exit( opts = { :expect_success => true } )

    not_nil( opts, :opts )

    msg = nil

    begin
        pid, stat = 
            BitGirder::Io.debug_wait2( :pid => @peer.pid, :name => :peer )

        unless stat.success?
            msg = "Peer #{pid} exited with non-success #{stat.exitstatus}"
        end
    rescue Errno::ECHILD
        msg = "Peer #{pid} appears to have exited already"
    end
    
    if msg
        if opts[ :expect_success ] then raise msg else warn msg end
    end
end

#exchange_message(msg) ⇒ Object



102
103
104
105
106
# File 'lib/mingle/io/stream.rb', line 102

def exchange_message( msg )
    
    @conn.write_message( msg )
    @conn.read_message
end