mirror of
https://github.com/openziti/zrok.git
synced 2025-06-02 16:16:17 +02:00
copyto; abort when there is no stdin (#379)
This commit is contained in:
parent
33a8088377
commit
c43f34083d
@ -16,10 +16,15 @@ const MAX_PASTE_SIZE = 64 * 1024
|
|||||||
var data []byte
|
var data []byte
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
var err error
|
stat, _ := os.Stdin.Stat()
|
||||||
data, err = io.ReadAll(os.Stdin)
|
if stat.Mode()&os.ModeCharDevice == 0 {
|
||||||
if err != nil {
|
var err error
|
||||||
panic(err)
|
data, err = io.ReadAll(os.Stdin)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
panic("usage: 'copyto' is requires input from stdin; pipe your paste buffer into it")
|
||||||
}
|
}
|
||||||
|
|
||||||
root, err := environment.LoadRoot()
|
root, err := environment.LoadRoot()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user