API Reference › Os › Os.pid
method

Os.pid

Os.pid() -> int

The operating system's id for this process — unique among the processes alive right now, so it is the natural suffix for scratch files that concurrent runs of the same tool must not share.

Example

program Pid {
  entry {
    let scratch = `{Os.temp_dir()}/mytool_{Os.pid()}.log`
    print(len(scratch) > 0)
  }
}
← All symbols