Running a program: pep-run
pep-run builds a program and runs it straight away, the way
python script.py runs a script: there is no -o to choose and no
executable to clean up. pepper run runs it with the same arguments.
pepper run hello.pep # build hello.pep, then run it
pepper run args.pep a b # main sees a and b
pepper run -O2 -D FAST main.pep # build options go before the file
pepper run -- --port 8080 # the project pep.toml describes
pepper run --entry bench tool.pep # start in bench() instead of main()
pep-run [BUILD OPTIONS] [<entry.pep>] [ARGUMENTS]...
pep-run [BUILD OPTIONS] -- [ARGUMENTS]...
Arguments
- The arguments before the entry file are
pep-build’s options (-O2,-D NAME,-I DIR,-l LIB, …; see The compiler: pep-build), and they apply as they do forpepper build, as do a project’s[build]table and its[Link]libraries. - The entry file is the first argument that ends in
.pepand does not start with-. Everything after it goes to the program’smain, options included: inpepper run tool.pep --help,--helpis the program’s. --ends the build options too. With no entry file,pep-runbuilds the project whosepep.tomlis in the current folder or the nearest folder above it, aspepper builddoes, and the arguments after--go to it.- The options that choose what
pep-buildwrites are not taken:-o,--lib,--test,--targetand the--emit-...options are an error that exits with status 2.
| Option | What it does |
|---|---|
--entry <name> | Starts the program in the function name instead of main, as pep-build --entry does; it takes no parameters or one String[] (before the entry file only) |
-h, --help | Prints the usage (before the entry file only) |
-V, --version | Prints the version (before the entry file only) |
How it runs
pep-runrunspep-build(besidepep-run, else on thePATH) to build the program into a folder of its own:<Pepper home>/run/<key>/<entry stem>(mainfor a project), where the key is a hash of the current folder, the build options and the entry file, and the Pepper home isPEPPER_HOME, else~/.pepper(%LOCALAPPDATA%\pepperon Windows; see Toolchains: pep-install).- The build cache is
PEPPER_CACHE_DIRwhen it is set, else<Pepper home>/cache, which every run shares, so the standard library is compiled once for all your scripts. When nothing changed,pep-buildfinds the program up to date and the run starts at once; when something did, only what changed is compiled again. - A compile error is reported exactly as
pepper buildreports it, nothing runs, andpep-runexits withpep-build’s status. - Otherwise the program runs in the folder
pep-runwas started in, so a relative path such asdata.txtis found there, withpep-run’s standard input, output and error. On Linux and macOS it takespep-run’s place, so signals such as Ctrl-C reach it directly; on Windowspep-runwaits for it. Either waypep-runexits with the program’s exit status.
Two runs of one program at the same time are safe: the linker writes the executable to a temporary file and renames it into place, so neither ever starts a half-written program.
The run folders are not removed on their own; delete <Pepper home>/run
to reclaim the space.