OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 package main | 5 package main |
6 | 6 |
7 import ( | 7 import ( |
8 "encoding/json" | 8 "encoding/json" |
9 "fmt" | 9 "fmt" |
10 "io" | 10 "io" |
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
339 if err := dec.Decode(&args); err != nil { | 339 if err := dec.Decode(&args); err != nil { |
340 return nil, err | 340 return nil, err |
341 } | 341 } |
342 return args, nil | 342 return args, nil |
343 } | 343 } |
344 | 344 |
345 // updateEnvironment adds common Butler bootstrapping environment variables | 345 // updateEnvironment adds common Butler bootstrapping environment variables |
346 // to the environment. | 346 // to the environment. |
347 func (cmd *runCommandRun) updateEnvironment(e environ, a *application) { | 347 func (cmd *runCommandRun) updateEnvironment(e environ, a *application) { |
348 e.set(bootstrap.EnvStreamPrefix, string(a.butler.Prefix)) | 348 e.set(bootstrap.EnvStreamPrefix, string(a.butler.Prefix)) |
| 349 e.set(bootstrap.EnvStreamProject, string(a.butler.Project)) |
349 | 350 |
350 // Set stream server path (if applicable) | 351 // Set stream server path (if applicable) |
351 if cmd.streamServerURI != "" { | 352 if cmd.streamServerURI != "" { |
352 e.set(bootstrap.EnvStreamServerPath, string(cmd.streamServerURI)
) | 353 e.set(bootstrap.EnvStreamServerPath, string(cmd.streamServerURI)
) |
353 } | 354 } |
354 } | 355 } |
355 | 356 |
356 // callbackReadCloser invokes a callback method when closed. | 357 // callbackReadCloser invokes a callback method when closed. |
357 type callbackReadCloser struct { | 358 type callbackReadCloser struct { |
358 io.ReadCloser | 359 io.ReadCloser |
359 callback func() | 360 callback func() |
360 } | 361 } |
361 | 362 |
362 func (c *callbackReadCloser) Close() error { | 363 func (c *callbackReadCloser) Close() error { |
363 defer c.callback() | 364 defer c.callback() |
364 return c.ReadCloser.Close() | 365 return c.ReadCloser.Close() |
365 } | 366 } |
OLD | NEW |