ipfs/kubo

`ipfs key rm` & `ipfs name publish` error out on empty stdin rather than doing nothing

Open

#4904 opened on Apr 1, 2018

View on GitHub
 (1 comment) (0 reactions) (0 assignees)Go (13,906 stars) (2,725 forks)batch import
help wantedkind/enhancementtopic/commands

Description

Version information:

go-ipfs version: 0.4.13- Repo version: 6 System version: amd64/linux Golang version: go1.9.4

Type:

Bug

Description:

ipfs key rm and ipfs name publish (and probably other ipfs commands) will, if invoked with no positional arguments, expect input from stdin, presumably so you can pipe in the output of other ipfs commands without needing to faff around with xargs.

The problem is that when input is empty, these commands fail:

$ ipfs name publish </dev/null
ipfs: Reading from /dev/stdin; send Ctrl-d to stop.
Error: invalid 'ipfs ref' path
$ ipfs key rm </dev/null
ipfs: Reading from /dev/stdin; send Ctrl-d to stop.
Error: invalid 'ipfs ref' path

Which is a problem when (as is often the case) the command generating the input may legitimately produce empty input, e.g. ipfs key list | grep remove-me | ipfs key rm.

Contributor guide