Hi list,
 While running some code in parallel on my Mavericks system using Julia 
Version 0.3.0-prerelease+1741, I needed to prevent importing Tk if the 
current user did not have a console session, as this would crash the worker 
processes. In case it might be of general interest, this was my solution:

function hasgui()
    username = split(readall(`who am i`))[1]
    return hasgui(username)
end

function hasgui(username::String)
    s = readall(`who`)
    return ismatch(Regex("$username[ \t]* console"),s)
end

Reply via email to