[chuck-users] Std.setenv() question
Joel Matthys
jwmatthys at gmail.com
Sat Sep 19 13:44:16 EDT 2015
Hmm, the same happens for me. Perhaps $HOSTNAME is null until polled, so
it is generated upon request by the command line call?
One possible workaround is to set an env variable right before launching
chuck, eg:
NETNAME="$HOSTNAME" chuck myfile.ck
and access Std.getenv("NETNAME") in your code.
I wasn't aware of setenv or getenv before. Did getenv("HOSTNAME") work
in the past?
Joel
On 09/18/2015 08:53 PM, Scott Smallwood wrote:
>
> Hey Chuckians…
>
> Question for those who use Std.setenv(). I’m trying to resurrect some
> old code of mine that made use of a special environment variable we
> used to use in plork to identify machines over the network. In short:
> this was a variable we called “NET_NAME”, in which we specified the
> network name address (i.e. blah.local) on our local area wireless network.
>
> What I’m wondering is this: in UNIX, there is usually a variable
> already in existence called “HOSTNAME”. For example, on my mac, when
> I type “echo $HOSTNAME” in the terminal, it returns a string that
> contains the name of my machine with .local appended to it.
>
> However, when I try to recall this variable using Std.setenv(), I get
> nothing.
>
> Anyone have any ideas here?
>
> —ss
>
> [ - ] Scott Smallwood <http://www.scott-smallwood.com> - Associate
> Professor - University of Alberta [ - ]
>
>
>
> _______________________________________________
> chuck-users mailing list
> chuck-users at lists.cs.princeton.edu
> https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cs.princeton.edu/pipermail/chuck-users/attachments/20150919/2f409877/attachment.html>
More information about the chuck-users
mailing list