File System / Process / CLI / Shell

Load at compile-time

  • #load .

    • Returns a []u8  of the file contents at compile time.

    • The loaded data is baked into your program.

    • You can provide a type name as a second argument; interpreting the data as being of that type.

  • #load_directory .

    • Loads all files within a directory, at compile time.

      • The data is name: string  and data: []byte .

    • All the data of those files will be baked into your program.

  • #load_hash .

    • Returns a constant integer of the hash of a file’s contents at compile time.

    • Available hashes: "adler32" , "crc32" , "crc64" , "fnv32" , "fnv64" , "fnv32a" , "fnv64a" , "murmur32" , or "murmur64" .

core:os2

  • core:os/os2

  • It will replace core:os  in 2026.

  • (2025-07-07)

    • It's not on the web docs yet. Technically it's still WIP, though some parts of it are quite usable.

  • process_exec

    • run with piped output and wait.

Process Execute
  • Must :

    • This procedure expects that stdout  and stderr  fields of the desc  parameter are left at default, i.e. a nil  value. You can not capture stdout/stderr and redirect it to a file at the same time.

    • assert(desc.stdout == nil, "Cannot redirect stdout when it's being captured", loc)

    • assert(desc.stderr == nil, "Cannot redirect stderr when it's being captured", loc)

  • Memory :

    • This procedure does not free stdout  and stderr  slices before an error is returned. Make sure to call delete  on these slices.

Process Start

core:os

core:c/libc

  • core:c/libc

  • Not native in Odin.

  • Has system  for just running basic command-line commands

  • (2025-10-29)

  • I was using libc.system  for some basic commands, but once I learned how to use the os2 , I think is much better and should be the go to for CLI.