Process
zune.process
A library that interacts with the system process.
Properties
args
The arguments passed to the process.
args: {string}env
The process enviroment table.
(Loaded from top to bottom)
- Includes
.envfile in the current working directory. - Includes
.env.productionfile in the current working directory. WhenLUAU_ENVis set toPRODUCTION. - Includes
.env.developmentfile in the current working directory. WhenLUAU_ENVis set toDEVELOPMENT. - Includes
.env.testfile in the current working directory. WhenLUAU_ENVis set toTEST. - Includes
.env.localfile in the current working directory.
env: <<table> = {
[string]: string
}table<table> = {
[string]: string
}>Functions
loadEnv
Same behavior as process.env, does not update process.env.
loadEnv(): {[string]: string}Throws
- IO Error
- Memory Error
cwd
Get the current working directory (absolute path).
cwd(): stringThrows
- IO Error
- Memory Error
pid
Get the current process ID.
pid(): numbercreate
Creates a new process.
create(exec: string, args: {string}?, opts: export type ProcessOptions = {
cwd: string?,
env: {
[string]: string
}?,
shell: (boolean | string)?,
stdin: ("inherit" | "pipe" | "ignore")?,
stdout: ("inherit" | "pipe" | "ignore")?,
stderr: ("inherit" | "pipe" | "ignore")?,
}ProcessOptionsexport type ProcessOptions = {
cwd: string?,
env: {
[string]: string
}?,
shell: (boolean | string)?,
stdin: ("inherit" | "pipe" | "ignore")?,
stdout: ("inherit" | "pipe" | "ignore")?,
stderr: ("inherit" | "pipe" | "ignore")?,
}?): ProcessChildParameters
exec: string- The executable to run.args: {string}?- The arguments to pass to the executable.opts: ProcessOptions?- The options for the process.cwd: string?- The current working directory of the process.env: {[string]: string}?- The environment variables to set for the process.shell: (boolean | string)?- The shell to use,truewould use the common shell for your os.stdin: ("inherit" | "pipe" | "ignore")?- The stdin configuration for the process.stdout: ("inherit" | "pipe" | "ignore")?- The stdout configuration for the process.stderr: ("inherit" | "pipe" | "ignore")?- The stderr configuration for the process.
Throws
- Process Error
run
Runs a new process, and yields for the result.
run(exec: string): export type ProcessResult = {
ok: boolean,
code: number,
}
export type ProcessRunResult<T> = ProcessResult & {
stdout: T,
stderr: T,
}ProcessRunResultexport type ProcessResult = {
ok: boolean,
code: number,
}
export type ProcessRunResult<T> = ProcessResult & {
stdout: T,
stderr: T,
}<string>
run(exec: string, args: {string}?): export type ProcessResult = {
ok: boolean,
code: number,
}
export type ProcessRunResult<T> = ProcessResult & {
stdout: T,
stderr: T,
}ProcessRunResultexport type ProcessResult = {
ok: boolean,
code: number,
}
export type ProcessRunResult<T> = ProcessResult & {
stdout: T,
stderr: T,
}<string>
run(exec: string, args: {string}?, opts: export type ProcessOptions = {
cwd: string?,
env: {
[string]: string
}?,
shell: (boolean | string)?,
stdin: ("inherit" | "pipe" | "ignore")?,
stdout: ("inherit" | "pipe" | "ignore")?,
stderr: ("inherit" | "pipe" | "ignore")?,
}ProcessOptionsexport type ProcessOptions = {
cwd: string?,
env: {
[string]: string
}?,
shell: (boolean | string)?,
stdin: ("inherit" | "pipe" | "ignore")?,
stdout: ("inherit" | "pipe" | "ignore")?,
stderr: ("inherit" | "pipe" | "ignore")?,
}?, bytes: false?): export type ProcessResult = {
ok: boolean,
code: number,
}
export type ProcessRunResult<T> = ProcessResult & {
stdout: T,
stderr: T,
}ProcessRunResultexport type ProcessResult = {
ok: boolean,
code: number,
}
export type ProcessRunResult<T> = ProcessResult & {
stdout: T,
stderr: T,
}<string?>
run(exec: string, args: {string}?, opts: export type ProcessOptions = {
cwd: string?,
env: {
[string]: string
}?,
shell: (boolean | string)?,
stdin: ("inherit" | "pipe" | "ignore")?,
stdout: ("inherit" | "pipe" | "ignore")?,
stderr: ("inherit" | "pipe" | "ignore")?,
}ProcessOptionsexport type ProcessOptions = {
cwd: string?,
env: {
[string]: string
}?,
shell: (boolean | string)?,
stdin: ("inherit" | "pipe" | "ignore")?,
stdout: ("inherit" | "pipe" | "ignore")?,
stderr: ("inherit" | "pipe" | "ignore")?,
}?, bytes: true): export type ProcessResult = {
ok: boolean,
code: number,
}
export type ProcessRunResult<T> = ProcessResult & {
stdout: T,
stderr: T,
}ProcessRunResultexport type ProcessResult = {
ok: boolean,
code: number,
}
export type ProcessRunResult<T> = ProcessResult & {
stdout: T,
stderr: T,
}<buffer?>
run(exec: string, args: {string}?, opts: export type ProcessOptions = {
cwd: string?,
env: {
[string]: string
}?,
shell: (boolean | string)?,
stdin: ("inherit" | "pipe" | "ignore")?,
stdout: ("inherit" | "pipe" | "ignore")?,
stderr: ("inherit" | "pipe" | "ignore")?,
}ProcessOptionsexport type ProcessOptions = {
cwd: string?,
env: {
[string]: string
}?,
shell: (boolean | string)?,
stdin: ("inherit" | "pipe" | "ignore")?,
stdout: ("inherit" | "pipe" | "ignore")?,
stderr: ("inherit" | "pipe" | "ignore")?,
}?, bytes: boolean?): export type ProcessResult = {
ok: boolean,
code: number,
}
export type ProcessRunResult<T> = ProcessResult & {
stdout: T,
stderr: T,
}ProcessRunResultexport type ProcessResult = {
ok: boolean,
code: number,
}
export type ProcessRunResult<T> = ProcessResult & {
stdout: T,
stderr: T,
}<string | buffer?>Parameters
exec: string- The executable to run.args: {string}?- The arguments to pass to the executable.opts: ProcessOptions?- The options for the process.cwd: string?- The current working directory of the process.env: {[string]: string}?- The environment variables to set for the process.shell: (boolean | string)?- The shell to use,truewould use the common shell for your os.stdin: ("inherit" | "pipe" | "ignore")?- The stdin configuration for the process.stdout: ("inherit" | "pipe" | "ignore")?- The stdout configuration for the process.stderr: ("inherit" | "pipe" | "ignore")?- The stderr configuration for the process.
bytes: false? | true | boolean?
Throws
- Process Error
exit
Exits the process with the given code.
exit(code: number): neverParameters
code: number- The exit code.
onSignal
Registers a signal handler.
Supported signals:
INT- Interrupt signal (SIGINT).
onSignal(signal: "INT", callback: () -> ()): ()Parameters
signal: "INT"- The signal to handle.callback: () -> ()- The callback to call when the signal is received.
Throws
- Process Error
- Thread Error
Last updated on