File tree Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -20,6 +20,12 @@ func failOnError(err error, msg string) {
20
20
}
21
21
}
22
22
23
+ func notApipe () {
24
+ fmt .Println ("The command is intended to work with pipes." )
25
+ fmt .Println ("Usage: echo mytext | stdin2rabbitmq" )
26
+ os .Exit (1 )
27
+ }
28
+
23
29
func read_in_stdin (debug bool ) string {
24
30
// massive copy and paste
25
31
// https://flaviocopes.com/go-shell-pipes/
@@ -35,13 +41,11 @@ func read_in_stdin(debug bool) string {
35
41
36
42
// if info.Mode()&os.ModeCharDevice != 0 || info.Size() <= 0 {
37
43
// ModeCharDevice works on a console where you have a terminal
38
- if ( info .Mode ()& os .ModeCharDevice == os .ModeCharDevice || info . Size () <= 0 ) {
44
+ if info .Mode ()& os .ModeCharDevice == os .ModeCharDevice {
39
45
// ModeNamedPipe is when you are ssh'd into something
40
- if (info .Mode ()& os .ModeNamedPipe == os .ModeNamedPipe || info .Size () <= 0 ) {
41
- fmt .Println ("The command is intended to work with pipes." )
42
- fmt .Println ("Usage: echo mytext | stdin2rabbitmq" )
43
- os .Exit (1 )
44
- }
46
+ //if (info.Mode()&os.ModeNamedPipe == os.ModeNamedPipe || info.Size() <= 0) {
47
+ notApipe ()
48
+ //}
45
49
}
46
50
47
51
reader := bufio .NewReader (os .Stdin )
You can’t perform that action at this time.
0 commit comments