how to get an environment variable's value?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

how to get an environment variable's value?

Travis Griggs-3
subject asks it all. I see references to OSProcess out on the net, but that class doesn't appear to exist in my Pharo image. I assume it's legal to ask Pharo related questions here?

--
Travis Griggs
Objologist
"No other topic generates more heat and less light than code formatting" --Kent Beck


Reply | Threaded
Open this post in threaded view
|

how to get an environment variable's value?

Travis Griggs-4
subject asks it all. I see references to OSProcess out on the net, but that class doesn't appear to exist in my Pharo image. I assume it's legal to ask Pharo related questions here?

--
Travis Griggs
Objologist
Light travels faster than sound. This is why some people appear bright until you hear them speak...





Reply | Threaded
Open this post in threaded view
|

Re: how to get an environment variable's value?

Igor Stasenko
On 18 March 2011 18:05, Travis Griggs <[hidden email]> wrote:
> subject asks it all. I see references to OSProcess out on the net, but that class doesn't appear to exist in my Pharo image. I assume it's legal to ask Pharo related questions here?
>
it is not Pharo related.
It is more VM/ OSProcess plugin related. :)
You can use ffi for getting env var value(s).

See FFI examples how to do that.
And of course if this supported by  OSProcess, then probablly you
should use it. But there are people who having more deep knowledge
about it than me. :)

> --
> Travis Griggs
> Objologist
> Light travels faster than sound. This is why some people appear bright until you hear them speak...
>
>
>
>
>
>



--
Best regards,
Igor Stasenko AKA sig.

Reply | Threaded
Open this post in threaded view
|

Re: how to get an environment variable's value?

Colin Putney-3
In reply to this post by Travis Griggs-4
On Fri, Mar 18, 2011 at 10:05 AM, Travis Griggs <[hidden email]> wrote:
> subject asks it all. I see references to OSProcess out on the net, but that class doesn't appear to exist in my Pharo image.

You can get OSProcess here:
http://map1.squeakfoundation.org/package/812c9d14-5236-4cad-82ea-cc3e3837e30d/autoversion/14.2

>I assume it's legal to ask Pharo related questions here?

Sure, but you might not get a useful answer for really Pharo-specific
stuff. OSProcess is used on Squeak, too, so this is a good place to
ask this particular question. :-)

Colin

Reply | Threaded
Open this post in threaded view
|

Re: how to get an environment variable's value?

David T. Lewis
In reply to this post by Travis Griggs-4
On Fri, Mar 18, 2011 at 10:05:42AM -0700, Travis Griggs wrote:
> subject asks it all. I see references to OSProcess out on the net, but
> that class doesn't appear to exist in my Pharo image. I assume it's
> legal to ask Pharo related questions here?

MCHttpRepository
    location: 'http://www.squeaksource.com/OSProcess'
    user: ''
    password: ''

OSProcess is an external package that you can load from SqueakSource.
I think there's a ConfigurationOfOSProcess that you can use (and on
Squeak you can load it through SqueakMap), but really I recommend
just opening a Montecello browser and loading the latest version, which
currently is OSProcess-dtl.59.mcz. If you are doing any fancy coordination
with external processes, you'll also want to load package CommandShell
(leave out the MVC stuff if you are using Pharo).

If you specifically want access to the environment and nothing else,
the necessary primitive is in the OSProcessPlugin that is distributed
with Unix/Mac VMs, so you can just call the primitive. But do load
a copy of OSProcess to see how it is done.

Dave


Reply | Threaded
Open this post in threaded view
|

Re: how to get an environment variable's value?

K K Subbu
On Saturday 19 Mar 2011 1:38:08 am David T. Lewis wrote:
> If you specifically want access to the environment and nothing else,
> the necessary primitive is in the OSProcessPlugin that is distributed
> with Unix/Mac VMs, so you can just call the primitive. But do load
> a copy of OSProcess to see how it is done.
Wouldn't it be simpler to just pass env variable values as arguments on the
command line and extract it within the image?

Subbu