// RunCommandInDir works like RunCommand, but runs with a context that uses dir. func RunCommandInDir(c *C, com cmd.Command, args []string, dir string) (*cmd.Context, error) { if err := InitCommand(com, args); err != nil { return nil, err } var context = ContextForDir(c, dir) return context, com.Run(context) }
func runCommand(com cmd.Command, args ...string) (opc chan dummy.Operation, errc chan error) { errc = make(chan error, 1) opc = make(chan dummy.Operation, 200) dummy.Listen(opc) go func() { // signal that we're done with this ops channel. defer dummy.Listen(nil) err := coretesting.InitCommand(com, args) if err != nil { errc <- err return } err = com.Run(cmd.DefaultContext()) errc <- err }() return }