@@ -60,12 +60,16 @@ func (t *ControllableTask) Launch() error {
6060 stderrIn , _ := taskCmd .StderrPipe ()
6161
6262 err := taskCmd .Start ()
63+ var tciCommandStr string
64+ if t .tci .Value != nil {
65+ tciCommandStr = * t .tci .Value
66+ }
6367 if err != nil {
6468 log .WithFields (logrus.Fields {
6569 "id" : t .ti .TaskID .Value ,
6670 "task" : t .ti .Name ,
6771 "error" : err ,
68- "command" : * t . tci . Value ,
72+ "command" : tciCommandStr ,
6973 }).
7074 Error ("failed to run task" )
7175
@@ -105,7 +109,7 @@ func (t *ControllableTask) Launch() error {
105109 log .WithFields (logrus.Fields {
106110 "id" : t .ti .TaskID .Value ,
107111 "task" : t .ti .Name ,
108- "command" : t . tci . Value ,
112+ "command" : tciCommandStr ,
109113 "elapsed" : elapsed .String (),
110114 }).
111115 Debug ("polling task for IDLE state reached" )
@@ -116,14 +120,14 @@ func (t *ControllableTask) Launch() error {
116120 WithFields (logrus.Fields {
117121 "state" : response .GetState (),
118122 "task" : t .ti .Name ,
119- "command" : t . tci . Value ,
123+ "command" : tciCommandStr ,
120124 }).
121125 Info ("cannot query task status" )
122126 } else {
123127 log .WithFields (logrus.Fields {
124128 "state" : response .GetState (),
125129 "task" : t .ti .Name ,
126- "command" : t . tci . Value ,
130+ "command" : tciCommandStr ,
127131 }).
128132 Debug ("task status queried" )
129133 }
@@ -133,7 +137,7 @@ func (t *ControllableTask) Launch() error {
133137 if reachedState == "STANDBY" && err == nil {
134138 log .WithField ("id" , t .ti .TaskID .Value ).
135139 WithField ("task" , t .ti .Name ).
136- WithField ("command" , t . tci . Value ).
140+ WithField ("command" , tciCommandStr ).
137141 Debug ("task running and ready for control input" )
138142 break
139143 } else if reachedState == "DONE" || reachedState == "ERROR" {
@@ -152,7 +156,7 @@ func (t *ControllableTask) Launch() error {
152156 return
153157 } else {
154158 log .WithField ("task" , t .ti .Name ).
155- WithField ("command" , t . tci . Value ).
159+ WithField ("command" , tciCommandStr ).
156160 Debugf ("task not ready yet, waiting %s" , startupPollingInterval .String ())
157161 time .Sleep (startupPollingInterval )
158162 elapsed += startupPollingInterval
@@ -214,15 +218,15 @@ func (t *ControllableTask) Launch() error {
214218 log .WithFields (logrus.Fields {
215219 "id" : t .ti .TaskID .Value ,
216220 "task" : t .ti .Name ,
217- "command" : t . tci . Value ,
221+ "command" : tciCommandStr ,
218222 }).Debug ("task done, preparing final update" )
219223
220224 pendingState := mesos .TASK_FINISHED
221225 if err != nil {
222226 log .WithFields (logrus.Fields {
223227 "id" : t .ti .TaskID .Value ,
224228 "task" : t .ti .Name ,
225- "command" : t . tci . Value ,
229+ "command" : tciCommandStr ,
226230 "error" : err .Error (),
227231 }).
228232 Error ("process terminated with error" )
@@ -248,7 +252,7 @@ func (t *ControllableTask) Launch() error {
248252 "errStdout" : errStdout ,
249253 "id" : t .ti .TaskID .Value ,
250254 "task" : t .ti .Name ,
251- "command" : t . tci . Value ,
255+ "command" : tciCommandStr ,
252256 }).
253257 Warning ("failed to capture stdout or stderr of task" )
254258 }
0 commit comments