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

Would like mode for 'call' that exposes the return value, and exits #4

Open
deanrad opened this issue Mar 19, 2015 · 1 comment
Open

Comments

@deanrad
Copy link

deanrad commented Mar 19, 2015

We have cli scripts that we want to call a ddp method, obtain the return value, then exit.. Can this be done with the tool in its current state?

@deanrad
Copy link
Author

deanrad commented Mar 19, 2015

Here's an expect script that gets it done. But I think my coworker @arnaudsj might be proposing an actual patch...

> ddp-exec.sh 8081 methodName arg1
spawn ddp --port 8081 call methodName arg1
[msg]: {"server_id":"0"}
[msg]: {"msg":"connected","session":"xR86i3vQcSNGyBEaf"}
[call]: methodName ["arg1"]
[msg]: {"msg":"updated","methods":["1"]}
[msg]: {"msg":"result","id":"1","result":{}}
> echo $?
0

> cat ddp_exec.sh
#!/usr/bin/expect --
set timeout 3
set port [lindex $argv 0]
set method [lindex $argv 1]
set arg [lindex $argv 2]
log_user 0 # uncomment to silence
spawn ddp --port $port call $method $arg
expect '"msg":"result"'

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

No branches or pull requests

1 participant