Skip to content

Commit 4402701

Browse files
committed
Special-case accepting explicitly supplied named pipes
1 parent bde31bb commit 4402701

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# go-ipfs changelog
22

3+
- Accept named fifos ( pipes ) when supplied directly as an argument, continues to reject them when encountered recursively
4+
- Require Go 1.14
35
- Remove gx
46

57
### 0.4.4 - 2016-10-11

cli/parse.go

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ import (
1111
"strings"
1212

1313
osh "github.com/Kubuxu/go-os-helper"
14-
"github.com/ipfs/go-ipfs-cmds"
15-
"github.com/ipfs/go-ipfs-files"
14+
cmds "github.com/ipfs/go-ipfs-cmds"
15+
files "github.com/ipfs/go-ipfs-files"
1616
logging "github.com/ipfs/go-log"
1717
)
1818

@@ -510,6 +510,15 @@ func appendFile(fpath string, argDef *cmds.Argument, recursive, hidden bool) (fi
510510
if !recursive {
511511
return nil, fmt.Errorf(notRecursiveFmtStr, fpath, cmds.RecShort)
512512
}
513+
} else if (stat.Mode() & os.ModeNamedPipe) != 0 {
514+
// Special case pipes that are provided directly on the command line
515+
// We do this here instead of go-ipfs-files, as we need to differentiate between
516+
// recursive(unsupported) and direct(supported) mode
517+
file, err := os.Open(fpath)
518+
if err != nil {
519+
return nil, err
520+
}
521+
return files.NewReaderPathFile(fpath, file, stat)
513522
}
514523

515524
return files.NewSerialFile(fpath, hidden, stat)

0 commit comments

Comments
 (0)