---
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/33109/
---
(Updated April 25, 2015, 9:11 a.m.)
Review request for mesos and Adam B.
Bugs: MESOS-2023
https://issues.apache.org/jira/browse/MESOS-2023
Repository: mesos
Description
---
Allow setting environment variables in mesos-execute
Diffs (updated)
-
include/mesos/type_utils.hpp cdf5864389a72002b538c263d70bcade2bdffa45
src/cli/execute.cpp 84f70dccbc2c5dd43f68105d967f4488c82f582b
src/common/parse.hpp 547b32041f39f0ff0c38179b66a32b2239134abc
Diff: https://reviews.apache.org/r/33109/diff/
Testing
---
### Test without env
```
$ ./src/mesos-execute --master=127.0.0.1:5050 --name=test --command='echo $a'
```
The log from mesos, we could see the output is empty
```
Registered executor on localhostI0423 01:27:37.180140 14061 slave.cpp:1540]
Sending queued task 'test' to executor 'test' of framework
20150423-012731-16777343-5050-14024-
Starting task test
Forked command at 14133
sh -c 'echo $a'
I0423 01:27:37.183823 14064 slave.cpp:2507] Handling status update TASK_RUNNING
(UUID: be8664ab-a4ca-409e-87e4-de3756506c4a) for task test of framework
20150423-012731-16777343-5050-14024- from executor(1)@127.0.0.1:33700
```
### Test with env from command
```
$ ./src/mesos-execute --master=127.0.0.1:5050 --name=test --command='echo $a'
--env={\a\: \stdin\}
```
The log from mesos, we could see the output is stdin
```
Registered executor on localhost
Starting task test
sh -c 'echo $a'
Forked command at 14783
stdin
I0423 01:30:41.750128 14063 slave.cpp:2507] Handling status update TASK_RUNNING
(UUID: e8b6cf52-9635-4393-94de-b16869e50c91) for task test of framework
20150423-012731-16777343-5050-14024-0001 from executor(1)@127.0.0.1:40051
```
### Test with env from file
```
$ cat /tmp/env
{a: file}
```
```
$ ./src/mesos-execute --master=127.0.0.1:5050 --name=test --command='echo $a'
--env=file:///tmp/env
```
The log from mesos, we could see the output is file
```
Registered executor on localhost
Starting task testsh -c 'echo $a'
Forked command at 15258
file
I0423 01:32:49.817705 14065 slave.cpp:2507] Handling status update TASK_RUNNING
(UUID: 9e8945d0-4921-41e8-a8e2-d64ec36eea16) for task test of framework
20150423-012731-16777343-5050-14024-0002 from executor(1)@127.0.0.1:56334
```
Thanks,
haosdent huang