set.tempdir: Change R's temporary directory

Description Usage Arguments Details Value Note Author(s) Examples

Description

set.tempdir changes the directury returned by tempdir(). It should only be used after forking (in particular when switching users) so that multiple processes don't share the temporary directory.

Usage

1

Arguments

path

string, path to use as the temporary directory

Details

Normally tempdir() is created and initialized on R startup and should not be changed. However, when using fork() the child process inherits the same directory which may not be desirable, in particular when the child wants to use set.user to change the owner. In such cases set.tempdir can be used to change the temporary directory that R will be using.

path will be passed to path.expand first.

Value

The newly set path

Note

set.tempdir does not check that the path is valid and/or writable. it is th eusere's responsibility to create teh path and then use set.tempdir, otherwise R may not function properly.

Author(s)

Simon Urbanek

Examples

1
2
3
4
5
6
## Not run: 
## create process-specific tempdir
dir.create(t <- paste(tempdir(), Sys.getpid(), sep='-'), FALSE, TRUE, "0700")
set.tempdir(t)

## End(Not run)

s-u/unixtools documentation built on May 28, 2019, 10:49 a.m.