Skip to content

tt run

Run the Tarantool of the current project, in the current directory.

The project is the one the current directory is in, as the instance commands find it: the nearest directory, the current one or one above it, holding app.manifest.toml or the pair of a template in .templates/<name>/, as tt create single_instance makes. No package is needed, and no tt environment and no tt.yaml are involved. The interpreter is the project's own, the one .tarantool/bin/tarantool of the project selects, and the first tarantool on PATH when there is none — TT_USE_SYSTEM_TARANTOOL=1 forces PATH either way. tt binary install and tt binary switch set that link; a with-deps tt package install sets it to the runtime the package bundles when the project selects no tarantool yet.

Tarantool runs in the current directory, as if started there by hand, so a script path is relative to it: 'tt run ../script.lua' in a subdirectory runs the script of the parent directory. Tarantool finds the project's .rocks/, dependencies and C modules included, by searching upward from the directory it runs in. Below the project root, tt puts the root at the head of LUA_PATH and LUA_CPATH, so the project's own sources, such as init.lua of the root, resolve as they do there; in the root, the environment is passed unchanged.

tt reads its own options, -h and --help, only among the options before the script name, and a '--' there ends them and is dropped. Every other argument goes to Tarantool untouched, and everything from the script name on, -h and '--' included, is the script's. tt replaces itself with the interpreter, so signals and the exit code are Tarantool's own.

Usage

tt run [TARANTOOL-OPTIONS...] [SCRIPT [ARGS...]]

Examples

# Start an interactive console in the project.
$ tt run

# Print the version of the Tarantool the project runs under:
$ tt run --version
Tarantool 3.0.0-entrypoint-724-gd2d7f4de3
. . .

# Run a script with arguments. Everything after the script name is the
# script's, -h and '--' included, because Tarantool itself is what reads
# them:
$ tt run script.lua a b c
a   b   c
$ tt run script.lua -- -h
--  -h

# Run a script of the parent directory from a subdirectory of the project:
$ cd test && tt run ../script.lua

# Hand Tarantool's own -h over to it:
$ tt run -- -h

# Execute stdin:
$ echo 'print(42)' | tt run -

# Ignore the project's tarantool and use the one on PATH:
$ TT_USE_SYSTEM_TARANTOOL=1 tt run script.lua