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

tarantool console doesn't work with unix pipes #672

Closed
kostja opened this issue Dec 23, 2014 · 9 comments

Comments

Projects
None yet
7 participants
@kostja
Copy link
Member

commented Dec 23, 2014

I would like to use tarantool console in batch mode, to execute remote commands.
I can't have a script with require('console').connect(arg[1]) and feed stuff into that script - this doesn't work.

This script writes 'need an existing console' when executed in pipe mode.

I was not even able to write a script like that with plain box.net.box && dostring, which should be easier, but I didn't pursue.

@kostja kostja added this to the 1.6.5 milestone Dec 23, 2014

@kostja

This comment has been minimized.

Copy link
Member Author

commented Dec 23, 2014

It was possible with Tarantool 1.5

@rtsisyk

This comment has been minimized.

Copy link
Contributor

commented Jan 15, 2015

cat xx | tarantool don't start our console. Instead of processing input line by line, tarantool passes stdin descriptor to Lua to process entire input with loadstring()/dofile() interface.

@kostja kostja modified the milestones: 1.6.6, 1.6.5 Jan 16, 2015

@kostja kostja added the feature label Feb 2, 2015

@pgulutzan

This comment has been minimized.

Copy link
Contributor

commented Feb 22, 2015

I am assuming that this bug report is about this error message:

localhost:3301> console.delimiter('!')
---
- error: 'builtin/console.lua:229: console.delimiter(): need existing console'
...

The message is cryptic and the situation is surely common, so I regret that this is called a "feature" request.

@kostja kostja modified the milestones: 1.6.7, 1.6.6 Apr 23, 2015

@khmelevskii

This comment has been minimized.

Copy link

commented May 19, 2015

tarantool test.lua
tarantool: builtin/console.lua:271: console.connect() need existing console

@kostja kostja modified the milestones: 1.6.7, 1.7 Aug 31, 2015

@kostja kostja modified the milestones: 1.6.9, 1.8 Feb 18, 2016

@kostja

This comment has been minimized.

Copy link
Member Author

commented Feb 18, 2016

@rybakit needs this feature as well, it's OK if it's available in tarantoolctl, not in tarantool itself.

@rtsisyk

This comment has been minimized.

Copy link
Contributor

commented Apr 13, 2016

console.connect() and console.delimiter() works only if you use an interactive console and/or tarantoolctl enter. cat lua.xx | tarantool works exactly as expected - like original Lua interpreter.
Why do you need delimiters for local files?

@rybakit

This comment has been minimized.

Copy link
Contributor

commented Apr 13, 2016

My use case was about executing arbitrary lua code for the concrete instance, something like

echo 'print(box.session.id())' | tarantoolctl eval instance

As a workaround, I use

echo "box.session.id()" | socat - UNIX-CONNECT:/var/run/tarantool/instance.control

but, besides it's not intuitive, it also outputs some garbage, which I need to take care of:

Tarantool 1.6.8-102-g094d13b (Lua console)
type 'help' for interactive help
---
- 8
...

@rtsisyk rtsisyk assigned knazarov and unassigned rtsisyk May 18, 2016

@rtsisyk rtsisyk modified the milestones: 1.7.3, 1.6.9 Aug 8, 2016

@rtsisyk rtsisyk removed the need feedback label Sep 9, 2016

@rtsisyk

This comment has been minimized.

Copy link
Contributor

commented Sep 9, 2016

Discussed with @bigbes and @kostja =>

$ echo 'expression' | tarantoolctl eval instance
---
- result
...
  • On success result should be printed to stdout as YAML and $? set to 0
  • On error (type(resp) == 'table' and resp.error ~= nil) result should be printed stderr and return code set to 1

@rtsisyk rtsisyk assigned bigbes and unassigned knazarov Sep 9, 2016

@kostja kostja added the prio2 label Sep 27, 2016

@kostja

This comment has been minimized.

Copy link
Member Author

commented Nov 22, 2016

Besides eval, it should work the same way for 'connect'. I'd actually say entire eval is unnecessary if we do it for connect, and allow instance names in connect.

@rtsisyk rtsisyk added the in progress label Dec 2, 2016

@rtsisyk rtsisyk modified the milestones: 1.7.4, 1.7.3 Dec 23, 2016

bigbes added a commit that referenced this issue Dec 27, 2016

bigbes added a commit that referenced this issue Dec 27, 2016

@bigbes bigbes added review and removed in progress labels Dec 27, 2016

bigbes added a commit that referenced this issue Dec 28, 2016

@rtsisyk rtsisyk closed this in 4d853ce Jan 9, 2017

rtsisyk added a commit that referenced this issue Jan 9, 2017

tarantoolctl: review fixes for gh-672
* Remove useless syntax checking:

   `echo "2+2" | tarantoolctl eval example` now works as well as
   `echo "return 2+2" | tarantoolctl eval example`

* Don't read file from the disk twice
* Improve error handling
* Streamline isatty() usage

@kostja kostja removed the review label Jan 9, 2017

rtsisyk added a commit that referenced this issue Jan 10, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.