System
argv
Get command-line parameters. The parameters are numbered starting from 1, the zeroth parameter being the script name.
Type:
(?default : string, int) -> string
Arguments:
default(of typestring, which defaults to"")(unlabeled)(of typeint)
environment
Return the process environment.
Type:
() -> [string * string]
environment.get
Get the value of an environment variable. Returns default if the variable is not set.
Type:
(?default : string, string) -> string
Arguments:
default(of typestring, which defaults to"")(unlabeled)(of typestring)
environment.set
Set the value associated to a variable in the process environment.
Type:
(string, string) -> unit
Arguments:
(unlabeled)(of typestring): Variable to be set.(unlabeled)(of typestring): Value to set.
exe_ext
Executable file extension.
Type:
string
exit
Immediately stop the application. This should only be used in extreme cases or to specify an exit value. The recommended way of stopping Liquidsoap is to use shutdown.
Type:
(int) -> unit
Arguments:
(unlabeled)(of typeint): Exit value.
getopt
Parse command line options:
getopt("-o") returns "1" if "-o" was passed without any parameter, "0" otherwise.
getopt(default="X","-o") returns "Y" if "-o Y" was passed, "X" otherwise.
The result is removed from the list of arguments, affecting subsequent
calls to argv() and getopt().
Type:
(?default : string, string) -> string
Arguments:
default(of typestring, which defaults to"")(unlabeled)(of typestring)
on_cleanup
Register a function to be called for the final cleanup.
Type:
((() -> unit)) -> unit
Arguments:
(unlabeled)(of type() -> unit)
on_shutdown
Register a function to be called when Liquidsoap shuts down.
Type:
((() -> unit)) -> unit
Arguments:
(unlabeled)(of type() -> unit)
on_start
Register a function to be called when Liquidsoap starts.
Type:
((() -> unit)) -> unit
Arguments:
(unlabeled)(of type() -> unit)
os.type
Type of OS running liquidsoap.
Type:
string
process.pid
Get the process' pid.
Type:
() -> int
process.quote
Return a quoted copy of the given string, suitable for use as one argument in a command line, escaping all meta-characters. Warning: under Windows, the output is only suitable for use with programs that follow the standard Windows quoting conventions.
Type:
(string) -> string
Arguments:
(unlabeled)(of typestring): String to escape
process.quote.command
Return a quoted command line, suitable for use as an argument to process.run.
The optional arguments stdin, stdout and stderr are file names used to redirect the standard input, the standard output, or the standard error of the command.
If stdin=f is given, a redirection < f is performed and the standard input of the command reads from file f.
If stdout=f is given, a redirection > f is performed and the standard output of the command is written to file f.
If stderr=f is given, a redirection 2> f is performed and the standard error of the command is written to file f.
If both stdout=f and stderr=f are given, with the exact same file name f, a 2>&1 redirection is performed so that the standard output and the standard error of the command are interleaved and redirected to the same file f.
Type:
(?stdin : string?, ?stdout : string?, ?stderr : string?, ?args : [string],
string) -> string
Arguments:
stdin(of typestring?, which defaults tonull): command standard inputstdout(of typestring?, which defaults tonull): command standard outputstderr(of typestring?, which defaults tonull): command standard errorargs(of type[string], which defaults to[]): command arguments(unlabeled)(of typestring): Command to execute
process.read
Perform a shell call and return its output.
Type:
(?timeout : float, ?env : [string * string], ?inherit_env : bool,
?log_errors : bool, string) -> string
Arguments:
timeout(of typefloat, which defaults to-1.0): Cancel process aftertimeouthas elapsed. Ignored if negative.env(of type[string * string], which defaults to[]): Process environmentinherit_env(of typebool, which defaults totrue): Inherit calling process's environment whenenvparameter is empty.log_errors(of typebool, which defaults totrue): Log details if the command does not return 0.(unlabeled)(of typestring): Command to run
process.read.lines
Perform a shell call and return the list of its output lines.
Type:
(?timeout : float, ?env : [string * string], ?inherit_env : bool,
?log_errors : bool, string) -> [string]
Arguments:
timeout(of typefloat, which defaults to-1.0): Cancel process aftertimeouthas elapsed. Ignored if negative.env(of type[string * string], which defaults to[]): Process environmentinherit_env(of typebool, which defaults totrue): Inherit calling process's environment whenenvparameter is empty.log_errors(of typebool, which defaults totrue): Log details if the command does not return 0.(unlabeled)(of typestring): Command to run
process.run
Run a process in a shell environment. Returns the standard output, as well as standard error and status as methods. The status can be "exit" (the status code is set), "killed" or "stopped" (the status code is the signal), or "exception" (the description is set) or "timeout" (the description is the run time).
Type:
(?env : [string * string], ?inherit_env : bool, ?stdin : string,
?rwdirs : [string], ?rodirs : [string], ?network : bool?, ?timeout : float?,
string) -> unit
Arguments:
env(of type[string * string], which defaults to[]): Process environmentinherit_env(of typebool, which defaults totrue): Inherit calling process's environment whenenvparameter is empty.stdin(of typestring, which defaults to""): Data to write to the process' standard input.rwdirs(of type[string], which defaults to["default"]): Read/write directories for sandboxing."default"expands to sandbox default.rodirs(of type[string], which defaults to["default"]): Read-only directories for sandboxing"default"expands to sandbox default.network(of typebool?, which defaults tonull): Enable or disable network inside sandboxed environment (sandbox default if not specified).timeout(of typefloat?, which defaults tonull): Cancel process aftertimeouthas elapsed. Ignored if negative.(unlabeled)(of typestring): Command to run
Methods:
status(of typestring.{code : int, description : string}): Status when process ended, can be one of"exit"(the program exited, thestatuscode is then relevant),"killed"(the program was killed by signal given instatuscode),"stopped"(the program was stopped by signal given instatuscode) or"exception"(the program raised and exception detailed in thedescription).stderr(of typestring): Messages written by process on standard error stream.stdout(of typestring): Messages written by process on standard output stream.
process.stderr
The process' stderr
Type:
socket
.{
close : () -> unit,
non_blocking : (bool) -> unit,
read : ((?timeout : float?) -> string)
.{wait : (?timeout : float?, (() -> unit)) -> unit
},
type : string,
write : ((?timeout : float?, string) -> unit)
.{wait : (?timeout : float?, (() -> unit)) -> unit
}
}
process.stdin
The process' stdin
Type:
socket
.{
close : () -> unit,
non_blocking : (bool) -> unit,
read : ((?timeout : float?) -> string)
.{wait : (?timeout : float?, (() -> unit)) -> unit
},
type : string,
write : ((?timeout : float?, string) -> unit)
.{wait : (?timeout : float?, (() -> unit)) -> unit
}
}
process.stdout
The process' stdout
Type:
socket
.{
close : () -> unit,
non_blocking : (bool) -> unit,
read : ((?timeout : float?) -> string)
.{wait : (?timeout : float?, (() -> unit)) -> unit
},
type : string,
write : ((?timeout : float?, string) -> unit)
.{wait : (?timeout : float?, (() -> unit)) -> unit
}
}
process.test
Return true if process exited with 0 code.
Type:
(?timeout : float, ?env : [string * string], ?inherit_env : bool, string) ->
bool
Arguments:
timeout(of typefloat, which defaults to-1.0): Cancel process aftertimeouthas elapsed. Ignored if negative.env(of type[string * string], which defaults to[]): Process environmentinherit_env(of typebool, which defaults totrue): Inherit calling process's environment whenenvparameter is empty.(unlabeled)(of typestring): Command to test
process.time
Get the execution time of the current liquidsoap process.
Type:
() -> unit
Methods:
system(of typefloat)user(of typefloat)
read
Read some value from standard input (console).
Type:
(?hide : bool) -> string
Arguments:
hide(of typebool, which defaults tofalse): Hide typed characters (for passwords).
reopen.stderr
Reopen standard error on the given file
Type:
(string) -> unit
Arguments:
(unlabeled)(of typestring)
reopen.stdin
Reopen standard input on the given file
Type:
(string) -> unit
Arguments:
(unlabeled)(of typestring)
reopen.stdout
Reopen standard output on the given file
Type:
(string) -> unit
Arguments:
(unlabeled)(of typestring)
restart
Restart the application.
Type:
() -> unit
runtime.gc.get
Return the current values of the GC parameters
Type:
() -> unit
Methods:
allocation_policy(of typeint)custom_major_ratio(of typeint)custom_minor_max_size(of typeint)custom_minor_ratio(of typeint)major_heap_increment(of typeint)max_overhead(of typeint)minor_heap_size(of typeint)space_overhead(of typeint)stack_limit(of typeint)verbose(of typeint)window_size(of typeint)
runtime.gc.print_stat
Print the current values of the memory management counters in human-readable form.
Type:
() -> unit
runtime.gc.quick_stat
Same as stat except that live_words, live_blocks, free_words, free_blocks, largest_free, and fragments are set to 0. This function is much faster than gc.stat because it does not need to go through the heap.
Type:
() -> unit
Methods:
compactions(of typeint)forced_major_collections(of typeint)fragments(of typeint)free_blocks(of typeint)free_words(of typeint)heap_chunks(of typeint)heap_words(of typeint)largest_free(of typeint)live_blocks(of typeint)live_words(of typeint)major_collections(of typeint)major_words(of typefloat)minor_collections(of typeint)minor_words(of typefloat)promoted_words(of typefloat)stack_size(of typeint)top_heap_words(of typeint)
runtime.gc.set
Set the GC parameters.
Type:
(
{
allocation_policy : int,
custom_major_ratio : int,
custom_minor_max_size : int,
custom_minor_ratio : int,
major_heap_increment : int,
max_overhead : int,
minor_heap_size : int,
space_overhead : int,
stack_limit : int,
verbose : int,
window_size : int
}) -> unit
Arguments:
(unlabeled)(of type{ allocation_policy : int, custom_major_ratio : int, custom_minor_max_size : int, custom_minor_ratio : int, major_heap_increment : int, max_overhead : int, minor_heap_size : int, space_overhead : int, stack_limit : int, verbose : int, window_size : int })
runtime.gc.stat
Return the current values of the memory management counters. This function examines every heap block to get the statistics.
Type:
() -> unit
Methods:
compactions(of typeint)forced_major_collections(of typeint)fragments(of typeint)free_blocks(of typeint)free_words(of typeint)heap_chunks(of typeint)heap_words(of typeint)largest_free(of typeint)live_blocks(of typeint)live_words(of typeint)major_collections(of typeint)major_words(of typefloat)minor_collections(of typeint)minor_words(of typefloat)promoted_words(of typefloat)stack_size(of typeint)top_heap_words(of typeint)
runtime.locale.set
Set the system's locale. This sets LANG and LC_ALL environment variables to the given value and then calls setlocale. This is set to "C" on startup, which defaults to the system's default locale. Keep in mind that changing this can potentially impact some functions such a float_of_string.
Type:
(string) -> unit
Arguments:
(unlabeled)(of typestring)
runtime.memory
Returns information about the system and process' memory.
Type:
() -> unit
Methods:
pretty(of type{ process_managed_memory : string, process_physical_memory : string, process_private_memory : string, process_swapped_memory : string, process_virtual_memory : string, total_physical_memory : string, total_used_physical_memory : string, total_used_virtual_memory : string, total_virtual_memory : string }):process_managed_memory(of typeint):process_physical_memory(of typeint):process_private_memory(of typeint):process_swapped_memory(of typeint):process_virtual_memory(of typeint):total_physical_memory(of typeint):total_used_physical_memory(of typeint):total_used_virtual_memory(of typeint):total_virtual_memory(of typeint):
runtime.sys.word_size
Size of one word on the machine currently executing the program, in bits. Either 32 or 64.
Type:
int
shutdown
Shutdown the application.
Type:
(?code : int) -> unit
Arguments:
code(of typeint, which defaults to0): Exit code. Default:0
source.is_up
Check whether a source is up.
Type:
(source('a)) -> bool
Arguments:
(unlabeled)(of typesource('a))