Skip to content

Prevent streams from being nil#12

Open
mfridman wants to merge 1 commit intomainfrom
mf/check-env
Open

Prevent streams from being nil#12
mfridman wants to merge 1 commit intomainfrom
mf/check-env

Conversation

@mfridman
Copy link
Member

@mfridman mfridman commented Mar 18, 2024

Putting this up for discussion.

Should we protect users from accidentally forgetting to set one of stdin, stdout or stderr to nil to avoid a panic?

The alternative, instead of failing with an error, is to set these to a sane default like os.Stdin, os.Stdout, os.Stderr.

Either option, sane default or explicit error, seems better than a panic?

EDIT: one more alternative -- have a WithEnv option, where run uses os.Stdin, os.Stdout, os.Stderr by default, but the caller can modify this behavior with a supplied option.

@bufdev
Copy link
Member

bufdev commented Mar 23, 2024

Yea we should do one or the other - I'm hesitant to default, but let's think about it.

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