protoplugin icon indicating copy to clipboard operation
protoplugin copied to clipboard

Prevent streams from being nil

Open mfridman opened this issue 1 year ago • 1 comments

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.

mfridman avatar Mar 18 '24 21:03 mfridman

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

bufdev avatar Mar 23 '24 18:03 bufdev