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 Mar 10, 2020
1 parent 8d013ec commit 02da9bd
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,10 +1,10 @@
package main

import (
"bufio"
"bytes"
"errors"
"fmt"
"io"
"io/ioutil"
"os"
"path/filepath"
Expand Down Expand Up @@ -66,10 +66,11 @@ var RootCmd = &cobra.Command{
// We detect whether we have anything on stdin to process if we have no arguments
// or if the argument is a -
if (len(args) < 1 || args[0] == "-") && !windowsStdinIssue && ((stat.Mode() & os.ModeCharDevice) == 0) {
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 02da9bd

Please sign in to comment.