# File lib/puppet/provider/service/launchd.rb, line 137 137: def status 138: # launchctl list <jobname> exits zero if the job is loaded 139: # and non-zero if it isn't. Simple way to check... but is only 140: # available on OS X 10.5 unfortunately, so we grab the whole list 141: # and check if our resource is included. The output formats differ 142: # between 10.4 and 10.5, thus the necessity for splitting 143: begin 144: output = launchctl :list 145: if output.nil? 146: raise Puppet::Error.new("launchctl list failed to return any data.") 147: end 148: output.split("\n").each do |j| 149: return :running if j.split(/\s/).last == resource[:name] 150: end 151: return :stopped 152: rescue Puppet::ExecutionFailure 153: raise Puppet::Error.new("Unable to determine status of #{resource[:name]}") 154: end 155: end