mirror of
https://github.com/rancher/os.git
synced 2025-08-14 13:03:22 +00:00
Re-add input from stdin
This commit is contained in:
parent
bfd9baa280
commit
67ee26adda
@ -289,11 +289,17 @@ func validate(c *cli.Context) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func inputBytes(c *cli.Context) ([]byte, error) {
|
func inputBytes(c *cli.Context) ([]byte, error) {
|
||||||
|
input := os.Stdin
|
||||||
inputFile := c.String("input")
|
inputFile := c.String("input")
|
||||||
if inputFile == "" {
|
if inputFile != "" {
|
||||||
return nil, errors.New("input parameter can not be empty")
|
var err error
|
||||||
|
input, err = os.Open(inputFile)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
}
|
}
|
||||||
content, err := ioutil.ReadFile(inputFile)
|
defer input.Close()
|
||||||
|
}
|
||||||
|
content, err := ioutil.ReadAll(input)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user