class Process

Defined in:

kernel.cr
process.cr
process/run.cr

Class Method Summary

Instance Method Summary

Instance methods inherited from class Reference

==(other)
==(other : self)
==
, dup dup, hash hash, inspect(io : IO) : Nil inspect, object_id : UInt64 object_id, same?(other : Reference)
same?(other : Nil)
same?
, to_s(io : IO) : Nil to_s

Instance methods inherited from class Object

!=(other) !=, !~(other) !~, ==(other) ==, ===(other)
===(other : YAML::Any)
===(other : JSON::Any)
===
, =~(other) =~, class class, crystal_type_id crystal_type_id, dup dup, hash hash, inspect(io : IO)
inspect
inspect
, itself itself, not_nil! not_nil!, tap(&block) tap, to_json to_json, to_pretty_json(io : IO)
to_pretty_json
to_pretty_json
, to_s
to_s(io : IO)
to_s
, to_yaml
to_yaml(io : IO)
to_yaml
, try(&block) try

Class methods inherited from class Object

==(other : Class) ==, ===(other) ===, cast(other) : self cast, clone clone, dup dup, from_json(string_or_io, root : String) : self
from_json(string_or_io) : self
from_json
, from_yaml(string : String) : self from_yaml, hash hash, inspect(io) inspect, name : String name, to_s(io) to_s, |(other : U.class) |

Class Method Detail

def self.after_fork_child_callbacks #

hooks defined here due to load order problems


[View source]
def self.exit(status = 0) #

[View source]
def self.fork : self | Nil #

Returns a Process.


[View source]
def self.fork(&block) #

Returns a Process.


[View source]
def self.kill(signal : Signal, *pids : Int) #

[View source]
def self.pgid(pid : Int32) : LibC::PidT #

[View source]
def self.pgid : LibC::PidT #

[View source]
def self.pid : LibC::PidT #

[View source]
def self.ppid : LibC::PidT #

[View source]
def self.run(cmd : String, args = nil, env : Env = nil, clear_env : Bool = false, shell : Bool = false, input : Stdio = nil, output : Stdio = nil, error : Stdio = nil, chdir : String | Nil = nil, &block) #

Executes a process, yields the block, and then waits for it to finish.

By default the process is configured to use pipes for input, output and error. These will be closed automatically at the end of the block.

Returns the block's value.


[View source]
def self.run(cmd : String, args = nil, env : Env = nil, clear_env : Bool = false, shell : Bool = false, input : Stdio = false, output : Stdio = false, error : Stdio = false, chdir : String | Nil = nil) : Process::Status #

Executes a process and waits for it to complete.

By default the process is configured without input, output or error.


[View source]
def self.times : Tms #

[View source]
def self.new(command : String, args = nil, env : Env = nil, clear_env : Bool = false, shell : Bool = false, input : Stdio = false, output : Stdio = false, error : Stdio = false, chdir : String | Nil = nil) #

Creates a process, executes it, but doesn't wait for it to complete.

To wait for it to finish, invoke #wait.

By default the process is configured without input, output or error.


[View source]
def self.new(pid) #

[View source]

Instance Method Detail

def close #

Closes any pipes to the child process.


[View source]
def error #

A pipe to this process's error. Raises if a pipe wasn't asked when creating the process.


[View source]
def error? : IO::FileDescriptor | Nil #

A pipe to this process's error. Raises if a pipe wasn't asked when creating the process.


[View source]
def input #

A pipe to this process's input. Raises if a pipe wasn't asked when creating the process.


[View source]
def input? : IO::FileDescriptor | Nil #

A pipe to this process's input. Raises if a pipe wasn't asked when creating the process.


[View source]
def kill(sig = Signal::TERM) #

See Process.kill


[View source]
def output #

A pipe to this process's output. Raises if a pipe wasn't asked when creating the process.


[View source]
def output? : IO::FileDescriptor | Nil #

A pipe to this process's output. Raises if a pipe wasn't asked when creating the process.


[View source]
def pid : Int32 #

[View source]
def wait : Process::Status #

Waits for this process to complete and closes any pipes.


[View source]