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

run external commands client side #2058

Merged
merged 2 commits into from
Dec 30, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cmd/ipfs/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ func callCommand(ctx context.Context, req cmds.Request, root *cmds.Command, cmd
}
}

if client != nil {
if client != nil && !cmd.External {
log.Debug("Executing command via API")
res, err = client.Send(req)
if err != nil {
Expand Down
38 changes: 38 additions & 0 deletions test/sharness/t0063-external.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/bin/sh
#
# Copyright (c) 2015 Jeromy Johnson
# MIT Licensed; see the LICENSE file in this repository.
#

test_description="test external command functionality"

. lib/test-lib.sh


# set here so daemon launches with it
PATH=`pwd`/bin:$PATH

test_init_ipfs

test_launch_ipfs_daemon

test_expect_success "create fake ipfs-update bin" '
mkdir bin &&
echo "#!/bin/sh" > bin/ipfs-update &&
echo "pwd" >> bin/ipfs-update &&
chmod +x bin/ipfs-update
'

test_expect_success "external command runs from current user directory" '
mkdir just_for_test &&
(cd just_for_test && ipfs update) > actual
'

test_expect_success "output looks good" '
echo `pwd`/just_for_test > exp &&
test_cmp exp actual
'

test_kill_ipfs_daemon

test_done