Pudu programming language
Menu
Package

@chrismichaelps / pudu-lang-environment

Environment files for Pudu: load .env variables safely with layered files, discovery, expansion, typed reads, and secrets kept out of every message

0.1.0Apache-2.01

InstallClose

ChildProcess.pudu

Pudu28 lines1016 B

GitHub ↗
1/** @Examples.ChildProcess.Program — loaded variables given to a child */2module ChildProcess34import Std.Io as Io5import Std.Process as Process6import PuduLangEnvironment.Loader as Loader7import PuduLangEnvironment.Options as Options8import PuduLangEnvironment.Source as Source9import PuduLangEnvironment.Variables as Variables1011/// Loads one variable and hands it to an isolated `printenv`, which sees nothing else.12fn main() -> Int {13  let options = Options.defaults().withSources(&[Source.Text("inline", "GREETING=hello from the environment file")])14  match Loader.load(&options) {15    case Ok(variables) => {16      let plan = Variables.apply(&variables, &Process.launch("printenv", &["GREETING"]).isolated())17      match Process.runLaunch(&plan, "") {18        case Ok(finished) => {19          let _shown = Io.writeLine(finished.output.trim())20          if finished.output.trim() == "hello from the environment file" { 0 } else { 1 }21        }22        case Err(_) => 123      }24    }25    case Err(_) => 126  }27}28