I’ve got a two problems with my web app (which is running on OS X)
I shell out to run commands. The commands I run require an environment variable to exist in order to function.
putting them in my users .profile works, and I can run the command from the terminal but the environment variable isn’t set when I shell out from my application.
The application has to write to a directory that is owned by root. How do I get my application to run ‘as root’?
I found
system.Environment(“MYVAR”)=“foo”
I set my backend to bash
I execute an env and I see that MYVAR is set…
I then run the command that requires the environment variable and it says it’s not set.
[quote]1) I shell out to run commands. The commands I run require an environment variable to exist in order to function.
putting them in my users .profile works, and I can run the command from the terminal but the environment variable isn’t set when I shell out from my application.[/quote]
This is standard behavior in every language. System Shell <> Terminal
There are a couple of ways around it:
write a script file and shell.execute it.
use an interactive shell and send whatever commands you need, one at a time.