NAME

Zuzu::Module::Proc - std/proc bindings for ZuzuScript.

DESCRIPTION

Implements std/proc, exporting Proc, Env, and sleep.

CLASSES

Env

Static helpers for reading and mutating process environment variables.

  • get(name, default?)

    Reads an environment variable. Returns default (or null) when not set.

  • set(name, value)

    Sets an environment variable and returns the new value.

  • remove(name)

    Unsets an environment variable.

Proc

Static helpers for interacting with operating-system processes.

  • pid

    Returns the current process ID.

  • run(command, argv?, options?)

    Runs an external process with IPC::Run. Returns a Dict with command, exit_code, signal, core_dump, ok, stdout, stderr, and error.

    command may be a string or an array-style command. argv provides additional arguments when command is a string.

    Options currently supported:

    • stdin

    • capture_stdout (default true)

    • capture_stderr (default true)

    • merge_stderr (default false)

    • cwd

  • kill(signal, pid?)

    Sends a signal. PID defaults to the current process.

  • onsignal(signal, callback)

    Registers a callback function to run when that signal is received.

  • exit(code)

    Immediately exits the current process with the provided status code.

sleep

Function:

  • sleep(seconds)

    Blocks the current process for the requested number of seconds. Fractional seconds are supported.

COPYRIGHT AND LICENCE

Zuzu::Module::Proc is copyright Toby Inkster.

It is free software; you may redistribute it and/or modify it under the terms of either the Artistic License 1.0 or the GNU General Public License version 2.