Skip to content
LexerLangv0.1.0

Process management

status, logs, stop and restart — seeing and managing running servers.

Terminal
lexer status
lexer logs <pid> [--lines N] [--follow]
lexer stop <pid>
lexer restart <pid>

status#

Lists running servers — both background ones and foreground ones:

Terminal
lexer status
Text
PID    SURE  YER       KIP          PORT  WATCH  DOSYA
77350  12s   arkaplan  production   3966  hayir  /path/app.lexer
77421  4s    onplan    development  3965  hayir  /path/app.lexer

YER says where the process runs (whether --background was given) and KIP which mode it is in (--production). These are separate questions: a background process can be in development mode.

Where the records live#

Each process writes a record to ~/.lexer/run/<pid>.json. When the process shuts down gracefully the record is removed. If it is killed with kill -9 the record stays on disk; lexer status notices and cleans it up itself, so no ghost process appears in the list.

logs#

Terminal
lexer logs 77350
lexer logs 77350 --lines 200
lexer logs 77350 --follow

--follow keeps the file open and prints new lines as they arrive, like tail -f.

lexer logs is only meaningful for background processes: in the foreground the output already goes to the terminal and there is no log file.

stop#

Terminal
lexer stop 77350

Stops gracefully: the server stops accepting new connections, finishes the requests in flight and then exits. The record file is removed.

restart#

Terminal
lexer restart 77350

Restarts the process with the same file and the same flags. You do not have to retype the command — the flags it was started with are in the record.

Rebuilding does not change what is running#

This one is easy to miss:

To pick up the change you must stop and restart:

Terminal
lexer stop <pid>
lexer serve app.lexer --background

If you are working inside the repository, make lexer-rebuild and make lexer-status list still-running servers via pslexer status only sees processes started by a version that can register itself, and cannot see servers opened with an older binary.

Next#

Cachelexer cache.