Method Process.daemon()


Method daemon

void daemon(int nochdir, int noclose, void|mapping(string:string|Stdio.File) modifiers)

Description

A function to run current program in the background.

Parameter nochdir

If 0 the process will continue to run in / or the directory dictadet by modifiers.

Parameter noclose

If this is not 0 the process will keep current file descriptors open.

Parameter modifiers

Optional extra arguments. The parameters passed in this mapping will override the arguments nochdir and noclose.

"cwd" : string

Change current working directory to this directory.

"stdin" : string|Stdio.File

If this is a string this will be interpreted as a filename pointing out a file to be used as stdandard input to the process. If this is a Stdio.File object the process will use this as standard input.

"stdout" : string|Stdio.File

If this is a string this will be interpreted as a filename pointing out a file to be used as stdandard output to the process. If this is a Stdio.File object the process will use this as standard output.

"stderr" : string|Stdio.File

If this is a string this will be interpreted as a filename pointing out a file to be used as stdandard error to the process. If this is a Stdio.File object the process will use this as standard error.

See also

System.daemon

Note

This function only works on UNIX-like operating systems.

Example

/* close all fd:s and cd to '/' */ Process.daemon(0, 0);

/* Do not change working directory. Write stdout to a file called access.log and stderr to error.log. */ Process.daemon(1, 0, ([ "stdout": "access.log", "stderr": "error.log" ]) );