[ditz-talk] I don't have all the same environment variables as you

William Morgan wmorgan-ditz at masanjin.net
Sun Apr 27 02:46:00 EDT 2008

Reformatted excerpts from Harold Hausman's message of 2008-04-21:
> Ditz is awesome. It hits on all the levels I like. Congratulations are
> in order. :)


> However, ditz makes some assumptions about environment variables that
> make it fail not-so-gracefully on some of my machines. (Their
> operating systems to remain nameless to protect the otherwise
> innocent.)

Got it. :)

> +    begin
> +      name = Etc.getpwnam(ENV["USER"]).gecos.split(/,/).first
> +    rescue
> +      name = "ditzy-user"
> +    end

> +    begin
> +      user = ENV["USER"]
> +    rescue
> +      user = "ditzy-user"
> +    end

This is the right idea but in both cases I would rather see the nil
value handled explicitly (even with a || in the latter case) rather than
rescue, which is overkill and might mask other legitimate exceptions in
the first case.

You can work up another patch and get your name in the official
ditz development history (oooh) or I'll throw something together. Thanks
for the bug report either way.

William <wmorgan-ditz at masanjin.net>

More information about the ditz-talk mailing list