Skip to content

Commit 5bac8dd

Browse files
committed
refacto: remove legacy code
/spend 2m
1 parent 464f06d commit 5bac8dd

File tree

1 file changed

+1
-24
lines changed

1 file changed

+1
-24
lines changed

gitime/reader/stdin.go

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3,33 +3,10 @@ package reader
33
import (
44
"fmt"
55
"io"
6-
"log"
76
"os"
87
)
98

10-
func DoesStdinHaveData() bool {
11-
fileInfo, err := os.Stdin.Stat()
12-
if err != nil {
13-
return false
14-
}
15-
16-
if os.Getenv("GIT_SPEND_NO_STDIN") == "1" {
17-
return false
18-
}
19-
20-
// Both yield false positives in CI, careful
21-
//if (fileInfo.Mode() & os.ModeCharDevice) == 0 { // alternatively?
22-
if (fileInfo.Mode() & os.ModeNamedPipe) != 0 {
23-
return true
24-
}
25-
26-
return false
27-
}
28-
299
func ReadStdin() string {
30-
stdin, err := io.ReadAll(os.Stdin)
31-
if err != nil {
32-
log.Fatal(err)
33-
}
10+
stdin, _ := io.ReadAll(os.Stdin)
3411
return fmt.Sprintf("%s", stdin)
3512
}

0 commit comments

Comments
 (0)