Skip to content

flatten ExecOpts into container.exec params#3402

Merged
vito merged 1 commit into
dagger:mainfrom
vito:flatten-exec-opts
Oct 18, 2022
Merged

flatten ExecOpts into container.exec params#3402
vito merged 1 commit into
dagger:mainfrom
vito:flatten-exec-opts

Conversation

@vito
Copy link
Copy Markdown
Contributor

@vito vito commented Oct 15, 2022

fixes #3340

I ended up needing this because I need to be able to pass Stdin but that results in setting RedirectStdout and RedirectStderr to an empty string because the ExecOpts struct wasn't a zero-value. Without this change I would get this from the shim:

15: [0.11s] panic: open : no such file or directory
15: [0.11s]
15: [0.11s] goroutine 1 [running]:
15: [0.11s] main.run()
15: [0.11s] 	/src/main.go:47 +0xad9
15: [0.11s] main.main()
15: [0.11s] 	/src/main.go:91 +0x19

So this promotes these params to exec params, removing the nesting, and removes the "" vs. nil distinction for stdin, redirectStdout, and redirectStderr.

I don't think there was any difference between stdin: "" and stdin: nil before anyway; one would set it to an empty file, and the other would send it to /dev/null. From the process's perspective both would just yield EOF.

I decided to keep a ContainerExecOpts type around under core since it feels nicer than passing string, string, string. 😄

@vito vito force-pushed the flatten-exec-opts branch from 8d34f39 to 7835cd0 Compare October 15, 2022 22:21
@vito vito requested review from aluzzardi and shykes October 17, 2022 17:16
Signed-off-by: Alex Suraci <alex@dagger.io>
@vito vito force-pushed the flatten-exec-opts branch from 7835cd0 to 78fe65c Compare October 18, 2022 20:08
@vito vito merged commit 1cc6d7b into dagger:main Oct 18, 2022
@vito vito deleted the flatten-exec-opts branch October 18, 2022 20:22
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.

API: inline ExecOpts in exec

2 participants