pub const PROCESS: &str = "//! The running program: its command-line arguments, and ending it with an\n//! exit status.\n//!\n//! `args()` returns the arguments the program was started with, and\n//! `exit(code)` ends it at once with the status `code`. Every module sees\n//! these names without an import, and a module\'s own `args` or `exit`\n//! shadows the one here.\n//!\n//! Reading the program\'s arguments. `exit` ends the program at once, so the\n//! example does not call it:\n//!\n//! ```\n//! let argv = args()\n//! // Index 0 names the program; the arguments it was given start at index 1.\n//! assert(argv.len() >= 1, \"index 0 is always there\")\n//! let name = argv.get(1).unwrap_or(\"world\") // `get` gives None past the end\n//! println(\"hello, ${name}\")\n//!\n//! // Each call returns a new Vec, so changing one changes no other.\n//! let mut mine = args()\n//! mine.push(\"--verbose\")\n//! assert_eq(args().len(), argv.len())\n//! ```\n\n// Nova standard library -- the running process: its arguments, and a way to\n// end it with a status.\n//\n// Compiled as an implicit module and glob-imported into every user module, so\n// `args()` and `exit(1)` need no `import` (docs/adr/0004-stdlib-compile-model.md).\n// A program\'s own `args` or `exit` shadows these.\n//\n// Of `nova-spec/20-STDLIB.md`\'s module-index entry, \"spawn, env, args\", only\n// `args` ships, with `exit`; `spawn` and `env` do not exist. See that file\'s\n// section 17, and docs/adr/0023-program-arguments.md.\n\n// The program\'s arguments. Index 0 is the program itself: under\n// `nova run [FILE] -- ARGS` it is FILE as written (`src/main.nova` when\n// defaulted), and in a built executable it is whatever the OS reports. The\n// arguments after `--`, or a built executable\'s own, follow from index 1. One\n// that is not valid Unicode has U+FFFD in place of its bad bytes.\n/// Returns the program\'s command-line arguments.\n///\n/// Index 0 names the program: under `nova run FILE -- ARGS` it is FILE as\n/// written, or without FILE the path of the `src/main.nova` it runs; in a\n/// built executable it is whatever the operating system reports. The\n/// arguments follow from index 1: under `nova run`, those after `--`. An\n/// argument that is not valid Unicode has U+FFFD in place of its bad bytes.\n/// Each call returns a new `Vec`, so changing one changes no other.\npub fn args() -> Vec<String> {\n let mut v: Vec<String> = Vec::new()\n let n = process_arg_count()\n let mut i = 0\n while i < n {\n v.push(process_arg(i))\n i = i + 1\n }\n v\n}\n\n// Ends the process now with `code`, after flushing stdout. Tasks still running\n// are not joined. The OS truncates `code`: Unix keeps its low 8 bits, so\n// `exit(256)` is 0 and `exit(-1)` is 255; Windows keeps 32. Under `nova run` it\n// ends the `nova` process itself.\n//\n// Typed `-> ()` because Nova has no never type: code after `exit(..)`\n// type-checks, and never runs.\n/// Ends the program at once with the exit status `code`, after flushing\n/// standard output.\n///\n/// Tasks still running are not waited for. The operating system keeps only\n/// part of `code`: Unix its low 8 bits, so `exit(256)` gives 0 and `exit(-1)`\n/// 255, and Windows 32 bits. Under `nova run` it ends the `nova` process\n/// itself. Code after a call to `exit` never runs.\npub fn exit(code: Int) { process_exit(code) }\n";Expand description
std/process/lib.nova.