D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
proc
/
self
/
root
/
opt
/
alt
/
ruby34
/
share
/
ri
/
system
/
Process
/
Filename :
kill-c.ri
back
Copy
U:RDoc::AnyMethod[iI" kill:ETI"Process::kill;TT:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"7Sends a signal to each process specified by +ids+ ;TI"+(which must specify at least one ID); ;TI"'returns the count of signals sent.;To:RDoc::Markup::BlankLine o; ; [I"%For each given +id+, if +id+ is:;T@o:RDoc::Markup::List: @type:BULLET:@items[o:RDoc::Markup::ListItem:@label0; [o; ; [I"HPositive, sends the signal to the process whose process ID is +id+.;To;;0; [o; ; [I"IZero, send the signal to all processes in the current process group.;To;;0; [o; ; [I"NNegative, sends the signal to a system-dependent collection of processes.;T@o; ; [I"8Argument +signal+ specifies the signal to be sent; ;TI"the argument may be:;T@o;; ;;[o;;0; [o; ; [I"6An integer signal number: e.g., +-29+, +0+, +29+.;To;;0; [o; ; [I"EA signal name (string), with or without leading <tt>'SIG'</tt>, ;TI"Gand with or without a further prefixed minus sign (<tt>'-'</tt>): ;TI" e.g.:;T@o;; ;;[ o;;0; [o; ; [I"<tt>'SIGPOLL'</tt>.;To;;0; [o; ; [I"<tt>'POLL'</tt>,;To;;0; [o; ; [I"<tt>'-SIGPOLL'</tt>.;To;;0; [o; ; [I"<tt>'-POLL'</tt>.;T@o;;0; [o; ; [I">A signal symbol, with or without leading <tt>'SIG'</tt>, ;TI"Gand with or without a further prefixed minus sign (<tt>'-'</tt>): ;TI" e.g.:;T@o;; ;;[ o;;0; [o; ; [I"+:SIGPOLL+.;To;;0; [o; ; [I" +:POLL+.;To;;0; [o; ; [I"<tt>:'-SIGPOLL'</tt>.;To;;0; [o; ; [I"<tt>:'-POLL'</tt>.;T@o; ; [I"If +signal+ is:;T@o;; ;;[o;;0; [o; ; [I"8A non-negative integer, or a signal name or symbol ;TI"$without prefixed <tt>'-'</tt>, ;TI"4each process with process ID +id+ is signalled.;To;;0; [o; ; [I"4A negative integer, or a signal name or symbol ;TI"!with prefixed <tt>'-'</tt>, ;TI"8each process group with group ID +id+ is signalled.;T@o; ; [I"?Use method Signal.list to see which signals are supported ;TI")by Ruby on the underlying platform; ;TI"3the method returns a hash of the string names ;TI"?and non-negative integer values of the supported signals. ;TI"=The size and content of the returned hash varies widely ;TI"among platforms.;T@o; ; [I"KAdditionally, signal +0+ is useful to determine if the process exists.;T@o; ; [I" Example:;T@o:RDoc::Markup::Verbatim; [I"pid = fork do ;TI"1 Signal.trap('HUP') { puts 'Ouch!'; exit } ;TI" # ... do some work ... ;TI" end ;TI"# ... ;TI"Process.kill('HUP', pid) ;TI"Process.wait ;T:@format0o; ; [I"Output:;T@o;; [I"Ouch! ;T;0o; ; [I"Exceptions:;T@o;; ;;[ o;;0; [o; ; [I"BRaises Errno::EINVAL or RangeError if +signal+ is an integer ;TI"but invalid.;To;;0; [o; ; [I"<Raises ArgumentError if +signal+ is a string or symbol ;TI"but invalid.;To;;0; [o; ; [I"BRaises Errno::ESRCH or RangeError if one of +ids+ is invalid.;To;;0; [o; ; [I"@Raises Errno::EPERM if needed permissions are not in force.;T@o; ; [I"IIn the last two cases, signals may have been sent to some processes.;T: @fileI"process.c;T:0@omit_headings_from_table_of_contents_below0I")Process.kill(signal, *ids) -> count ;T0[ I"(*args);T@�FI"Process;TcRDoc::NormalModule00