Skip to content

Commit

Permalink
Fix long lines not working over stdin
Browse files Browse the repository at this point in the history
  • Loading branch information
carlpett committed Apr 29, 2020
1 parent e0ecf29 commit 2b8681a
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions main.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package main

import (
"bufio"
"bytes"
"crypto/tls"
"errors"
"fmt"
"io"
"io/ioutil"
"net/http"
"os"
Expand Down Expand Up @@ -82,10 +82,11 @@ var RootCmd = &cobra.Command{
notty := (stat.Mode() & os.ModeCharDevice) == 0
noFileOrDirArgs := (len(args) < 1 || args[0] == "-") && len(directories) < 1
if noFileOrDirArgs && !windowsStdinIssue && notty {
var buffer bytes.Buffer
scanner := bufio.NewScanner(os.Stdin)
for scanner.Scan() {
buffer.WriteString(scanner.Text() + "\n")
buffer := new(bytes.Buffer)
_, err := io.Copy(buffer, os.Stdin)
if err != nil {
log.Error(err)
os.Exit(1)
}
schemaCache := kubeval.NewSchemaCache()
config.FileName = viper.GetString("filename")
Expand Down

0 comments on commit 2b8681a

Please sign in to comment.