proton_process

Native child process spawning for MoonBit on Windows, Linux, and macOS.

process
spawn
native
windows
linux
macos
child-process
moon add moonbit-community/proton_process@0.1.18
Download zip
Version
0.1.18
License
Apache-2.0
Last updated
5 hours ago
Downloads
6
README

moonbit-community/proton_process does not have a README file

#
ProcessError

pub(all) suberror ProcessError {
SpawnFailed(detail~ : String)
WaitFailed(detail~ : String)
KillFailed(detail~ : String)
} derive(Eq)

Failures while spawning or managing a child process.

#
ProcessError::equal

#
ProcessError::not_equal

fn ProcessError::not_equal(x : ProcessError, y : ProcessError) -> Bool

#
ProcessError::output

fn ProcessError::output(self : ProcessError, logger : &Logger) -> Unit

#
ProcessError::to_string

fn ProcessError::to_string(self : ProcessError) -> String

#
Process

pub struct Process {
// private fields
}

A native child process handle.

Created by Process::spawn and must be explicitly closed via Process::close to release native resources. The handle is not thread-safe and must be used from the thread that created it.

#
Process::close

fn Process::close(self : Process) -> Unit

Releases native resources associated with this process handle. After calling this, the handle is no longer valid.

#
Process::kill

fn Process::kill(self : Process) -> Unit raise ProcessError

Terminates the process. On POSIX this sends SIGTERM; on Windows it calls TerminateProcess. Safe to call after the process has already exited.

#
Process::pid

fn Process::pid(self : Process) -> Int

Returns the operating system process ID.

#
Process::spawn

fn Process::spawn(command : String, args? : Array[String], cwd? : String?, capture_output? : Bool) -> Process raise ProcessError

Spawns a new child process.

  • command: the program to execute (e.g. "ls", "cmd.exe").
  • args~: command-line arguments.
  • cwd~: optional working directory; None inherits the parent's.
  • capture_output~: reserved for future use; currently ignored.

#
Process::try_wait

fn Process::try_wait(self : Process) -> Int? raise ProcessError

Non-blocking wait. Returns Some(exit_code) if the process has exited, or None if it is still running.

#
Process::wait

fn Process::wait(self : Process) -> Int raise ProcessError

Blocking wait for the process to exit. Returns the exit code.

#
State

pub type State

Represents a native child process managed by the current platform.

Powered by MoonBit

Site sourceReport issuePackagesBuild queueSkillsStatistics

© 2026 mooncakes.io