MCPcopy Index your code
hub / github.com/cloudfoundry/cli / CustomCF

Function CustomCF

integration/helpers/command.go:46–70  ·  view source on GitHub ↗

CustomCF runs a 'cf' command with a custom environment and given arguments.

(cfEnv CFEnv, args ...string)

Source from the content-addressed store, hash-verified

44
45// CustomCF runs a 'cf' command with a custom environment and given arguments.
46func CustomCF(cfEnv CFEnv, args ...string) *Session {
47 command := exec.Command("cf", args...)
48 if cfEnv.Stdin != nil {
49 command.Stdin = cfEnv.Stdin
50 }
51 if cfEnv.WorkingDirectory != "" {
52 command.Dir = cfEnv.WorkingDirectory
53 }
54
55 if cfEnv.EnvVars != nil {
56 env := os.Environ()
57 for key, val := range cfEnv.EnvVars {
58 env = AddOrReplaceEnvironment(env, key, val)
59 }
60 command.Env = env
61 }
62
63 WriteCommand("", cfEnv.EnvVars, args)
64 session, err := Start(
65 command,
66 NewPrefixedWriter(DebugOutPrefix, GinkgoWriter),
67 NewPrefixedWriter(DebugErrPrefix, GinkgoWriter))
68 Expect(err).NotTo(HaveOccurred())
69 return session
70}
71
72// DebugCustomCF runs a 'cf' command with a custom environment and given
73// arguments, with CF_LOG_LEVEL set to 'debug'.

Calls 4

AddOrReplaceEnvironmentFunction · 0.85
WriteCommandFunction · 0.85
CommandMethod · 0.65
StartFunction · 0.50

Tested by 2

ExampleWithHelloWorldAppFunction · 0.74