FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Introduce the ExecutorBuilder. by mlhamel · Pull Request #273 · devbuddy/devbuddy · GitHub

Introduce the ExecutorBuilder. - #273

Open
mlhamel wants to merge 5 commits into
mainfrom
introduce-executor-builder
Open

Introduce the ExecutorBuilder.#273
mlhamel wants to merge 5 commits into
mainfrom
introduce-executor-builder

Conversation

mlhamel commented Jan 14, 2019

Copy link
Copy Markdown
Collaborator

Why

It would be handy to generate executor from the task context: in the future by example we would be able to keep trace of every requested commands.

How

This PR is introducing a set of interfaces for the ExecutorBuilder but also the Executor itself.

Following PR will add the builder into the TaskContext

mlhamel requested a review from pior as a code owner January 14, 2019 02:40
Comment thread pkg/executor/executor_builder.go Outdated

// ExecutorBuilder build executor with specific program and args
type ExecutorBuilder interface {
NewExecutor(program string, args ...string) Executor

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

or Simply New?

Comment thread pkg/executor/executor_builder.go Outdated
// ExecutorBuilder build executor with specific program and args
type ExecutorBuilder interface {
NewExecutor(program string, args ...string) Executor
NewShell(cmdline string) Executor

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

or NewExecutorShell ?

Comment thread pkg/executor/executor_builder_impl.go Outdated
package executor

type executorBuilderImpl struct {
}

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

What do you think of keeping the struct private ?

executor.SetOutputPrefix("---")
result := executor.Run()
impl := executor.(*executorImpl)
impl.outputWriter = buf

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I was searching for a better way but i cannot think of something

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I think this is fine for now. We could improve this by introducing a executor.SetOutputWriter(writer) at some point.

pior commented Jan 15, 2019

Copy link
Copy Markdown
Member

The Executor interface is great. Maybe we should try to ship this first?

I don't see the big picture about the builder interface... maybe this should be another PR, also including how we use this builder.

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants


Back | FazBrowse Home | New Git URL