icns

Easily create .icns files (Mac Icons) with this Go library or the included CLI.
Log | Files | Refs | LICENSE

pipe.go (357B)


      1 package main
      2 
      3 import (
      4 	"fmt"
      5 	"os"
      6 )
      7 
      8 // stdinIsPipe reports whether stdin is a pipe or redirected file rather than
      9 // an interactive terminal.
     10 func stdinIsPipe() (bool, error) {
     11 	info, err := os.Stdin.Stat()
     12 	if err != nil {
     13 		return false, fmt.Errorf("getting info on stdin file descriptor: %w", err)
     14 	}
     15 	return info.Mode()&os.ModeCharDevice == 0, nil
     16 }