W3cubDocs

/Pony

_ProcessPosix

[Source]

class ref _ProcessPosix is
  _Process ref

Implements

Constructors

create

[Source]

new ref create(
  path: String val,
  args: Array[String val] val,
  vars: Array[String val] val,
  stdin: _Pipe ref,
  stdout: _Pipe ref,
  stderr: _Pipe ref)
: _ProcessPosix ref^ ?

Parameters

Returns

Public fields

let pid: I32 val

[Source]

Public Functions

kill

[Source]

Terminate the process, first trying SIGTERM and if that fails, try SIGKILL.

fun box kill()
: None val

Returns

wait

[Source]

fun ref wait()
: I32 val

Returns

Private Functions

_make_argv

[Source]

Convert an array of String parameters into an array of C pointers to same strings.

fun tag _make_argv(
  args: Array[String val] box)
: Array[Pointer[U8 val] tag] ref

Parameters

Returns

_child_fork

[Source]

We are now in the child process. We redirect STDIN, STDOUT and STDERR to their pipes and execute the command. The command is executed via execve which does not return on success, and the text, data, bss, and stack of the calling process are overwritten by that of the program loaded. We've set the FD_CLOEXEC flag on all file descriptors to ensure that they are all closed automatically once @execve gets called.

fun box _child_fork(
  path: String val,
  argp: Array[Pointer[U8 val] tag] ref,
  envp: Array[Pointer[U8 val] tag] ref,
  stdin: _Pipe ref,
  stdout: _Pipe ref,
  stderr: _Pipe ref)
: None val

Parameters

Returns

_dup2

[Source]

Creates a copy of the file descriptor oldfd using the file descriptor number specified in newfd. If the file descriptor newfd was previously open, it is silently closed before being reused. If dup2() fails because of EINTR we retry.

fun tag _dup2(
  oldfd: U32 val,
  newfd: U32 val)
: None val

Parameters

  • oldfd: U32 val
  • newfd: U32 val

Returns

© 2016-2018, The Pony Developers
© 2014-2015, Causality Ltd.
Licensed under the BSD 2-Clause License.
https://stdlib.ponylang.io/process-_ProcessPosix