Project

General

Profile

Bug #15480 ยป kernel-system-docs.patch

zverok (Victor Shepelev), 12/29/2018 09:44 AM

View differences:

process.c
4417 4417

  
4418 4418
/*
4419 4419
 *  call-seq:
4420
 *     system([env,] command... [,options])    -> true, false or nil
4420
 *     system([env,] command... [,options], exception: false)    -> true, false or nil
4421 4421
 *
4422 4422
 *  Executes _command..._ in a subshell.
4423 4423
 *  _command..._ is one of following forms.
4424 4424
 *
4425
 *    commandline                 : command line string which is passed to the standard shell
4426
 *    cmdname, arg1, ...          : command name and one or more arguments (no shell)
4427
 *    [cmdname, argv0], arg1, ... : command name, argv[0] and zero or more arguments (no shell)
4425
 *  [<code>commandline</code>]
4426
 *    command line string which is passed to the standard shell
4427
 *  [<code>cmdname, arg1, ...</code>]
4428
 *    command name and one or more arguments (no shell)
4429
 *  [<code>[cmdname, argv0], arg1, ...</code>]
4430
 *    command name, <code>argv[0]</code> and zero or more arguments (no shell)
4428 4431
 *
4429 4432
 *  system returns +true+ if the command gives zero exit status,
4430 4433
 *  +false+ for non zero exit status.
4431 4434
 *  Returns +nil+ if command execution fails.
4432 4435
 *  An error status is available in <code>$?</code>.
4436
 *
4437
 *  If <code>exception: true</code> argument is passed, the method
4438
 *  raises exception instead of +false+ or +nil+.
4439
 *
4433 4440
 *  The arguments are processed in the same way as
4434
 *  for <code>Kernel.spawn</code>.
4441
 *  for Kernel#spawn.
4435 4442
 *
4436 4443
 *  The hash arguments, env and options, are same as
4437 4444
 *  <code>exec</code> and <code>spawn</code>.
4438
 *  See <code>Kernel.spawn</code> for details.
4445
 *  See Kernel#spawn for details.
4439 4446
 *
4440 4447
 *     system("echo *")
4441 4448
 *     system("echo", "*")
......
4445 4452
 *     config.h main.rb
4446 4453
 *     *
4447 4454
 *
4448
 *  See <code>Kernel.exec</code> for the standard shell.
4455
 *  Errors handling:
4456
 *
4457
 *     system("cat nonexistent.txt")
4458
 *     # => false
4459
 *     system("catt nonexistent.txt")
4460
 *     # => nil
4461
 *
4462
 *     system("cat nonexistent.txt", exception: true)
4463
 *     # RuntimeError (Command failed with exit 1: cat)
4464
 *     system("catt nonexistent.txt", exception: true)
4465
 *     # Errno::ENOENT (No such file or directory - catt)
4466
 *
4467
 *  See Kernel#exec for the standard shell.
4449 4468
 */
4450 4469

  
4451 4470
static VALUE