Current section

Files

Jump to
toolshed lib_src core hostname.ex
Raw

lib_src/core/hostname.ex

# SPDX-FileCopyrightText: 2022 Masatoshi Nishiguchi
# SPDX-FileCopyrightText: 2023 Frank Hunleth
#
# SPDX-License-Identifier: Apache-2.0
#
defmodule Toolshed.Core.Hostname do
require Record
@doc """
Return the hostname
## Examples
iex> hostname
"nerves-1234"
"""
@spec hostname() :: String.t()
def hostname() do
{:ok, hostname_charlist} = :inet.gethostname()
to_string(hostname_charlist)
end
end