New versions of {system hostname}, {system ip} using Jim API

This commit is contained in:
df 2020-11-04 19:09:42 +00:00
parent 2057c7ac75
commit 743ca7b75f
1 changed files with 1 additions and 1 deletions

View File

@ -30,7 +30,7 @@ proc {system hostname} {} {
proc {system ip} {} {
# try for a usable IP address of the machine (w/o parsing hosts file)
set ip "127.0.0.1"
if {![catch {set mysock [socket dgram "[os.gethostname]:0"]]}]} {
if {![catch {set mysock [socket dgram "[os.gethostname]:0"]}]} {
set myip ""
catch { set myip [lindex [split [$mysock sockname] ":"] 0]
$mysock close }