Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stdin parsing optional arg #1263

Merged
merged 5 commits into from
May 21, 2015
Merged

Stdin parsing optional arg #1263

merged 5 commits into from
May 21, 2015

Conversation

chriscool
Copy link
Contributor

This should fix issue #1260 (Ipfs crashes when run as a node subprocess).

This is based on top of @lgierth 's PR #1255 (parse: fix handling of unwanted stdin) as it modifies the same line of code.

Lars Gierth and others added 5 commits May 20, 2015 04:23
There can be non-terminal (i.e. non-interactive) sessions
that are *not* a pipe, for example:

	ssh user@host ipfs version

In this case, it looks like we should read from stdin.
Parsing stdin is accomplished by deliberately triggering
the parsing loop once.

We didn't previously check whether there is an ArgDef to support
that loop iteration.
License: MIT
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
License: MIT
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
License: MIT
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
@jbenet jbenet added the status/in-progress In progress label May 20, 2015
@ghost ghost mentioned this pull request May 20, 2015
@krl
Copy link
Contributor

krl commented May 20, 2015

This works for me, thx @lgierth and @chriscool for unblocking me!

@jbenet
Copy link
Member

jbenet commented May 21, 2015

LGTM. will merge after tests

@jbenet
Copy link
Member

jbenet commented May 21, 2015

(any year now)

@chriscool
Copy link
Contributor Author

There are some sharness test errors in the Travis PR build but they are not related:

expecting success:
iptb -n=4 -p=9000 init &&
iptb -wait start
Started daemon 0, pid = 10725
Started daemon 1, pid = 10739
Started daemon 2, pid = 10747
Started daemon 3, pid = 10756
ipfs start err: node at 127.0.0.1:10000 failed to bootstrap in given time period
not ok 1 - set up an iptb cluster
#
# iptb -n=4 -p=9000 init &&
# iptb -wait start
# 
expecting success:
test_kill_repeat_10_sec $IPFS_PID
not ok 39 - 'ipfs daemon' can be killed
#
# test_kill_repeat_10_sec $IPFS_PID
# 
expecting success:
echo "Error: open $IPFS_PATH/repo.lock: permission denied" > init_fail_exp &&
test_cmp init_fail_out init_fail_exp
> diff -u init_fail_out init_fail_exp
--- init_fail_out 2015-05-21 04:12:57.000000000 +0000
+++ init_fail_exp 2015-05-21 04:12:57.000000000 +0000
@@ -1,2 +1 @@
-Error: ipfs daemon is running. please stop it to run this command
-Use 'ipfs init --help' for information about this command
+Error: open /Users/travis/gopath/src/github.com/ipfs/go-ipfs/test/sharness/trash directory.t0020-init.sh/.badipfs/repo.lock: permission denied
not ok 3 - ipfs init output looks good
#
# echo "Error: open $IPFS_PATH/repo.lock: permission denied" > init_fail_exp &&
# test_cmp init_fail_out init_fail_exp
#

jbenet added a commit that referenced this pull request May 21, 2015
@jbenet jbenet merged commit 1f8230c into master May 21, 2015
@jbenet jbenet removed the status/in-progress In progress label May 21, 2015
@jbenet jbenet deleted the stdin-parsing-optional-arg branch May 21, 2015 05:30
@jbenet
Copy link
Member

jbenet commented May 21, 2015

thanks @chriscool and @lgierth !

chriscool added a commit that referenced this pull request May 22, 2015
This issue has been fixed by merging PR #1263 or PR #1238.

License: MIT
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
chriscool added a commit that referenced this pull request May 22, 2015
This issue has been fixed by merging PR #1263 or PR #1238.

License: MIT
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
@wking wking mentioned this pull request Jun 12, 2015
@ghost ghost mentioned this pull request Jan 2, 2016
@ghost ghost mentioned this pull request May 19, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants