D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
proc
/
thread-self
/
root
/
proc
/
thread-self
/
root
/
opt
/
alt
/
ruby18
/
share
/
ri
/
1.8
/
system
/
Dir
/
Filename :
chdir-c.yaml
back
Copy
--- !ruby/object:RI::MethodDescription aliases: [] block_params: comment: - !ruby/struct:SM::Flow::P body: Changes the current working directory of the process to the given string. When called without an argument, changes the directory to the value of the environment variable <tt>HOME</tt>, or <tt>LOGDIR</tt>. <tt>SystemCallError</tt> (probably <tt>Errno::ENOENT</tt>) if the target directory does not exist. - !ruby/struct:SM::Flow::P body: If a block is given, it is passed the name of the new current directory, and the block is executed with that as the current directory. The original working directory is restored when the block exits. The return value of <tt>chdir</tt> is the value of the block. <tt>chdir</tt> blocks can be nested, but in a multi-threaded program an error will be raised if a thread attempts to open a <tt>chdir</tt> block while another thread has one open. - !ruby/struct:SM::Flow::VERB body: " Dir.chdir("/var/spool/mail")\n puts Dir.pwd\n Dir.chdir("/tmp") do\n puts Dir.pwd\n Dir.chdir("/usr") do\n puts Dir.pwd\n end\n puts Dir.pwd\n end\n puts Dir.pwd\n" - !ruby/struct:SM::Flow::P body: <em>produces:</em> - !ruby/struct:SM::Flow::VERB body: " /var/spool/mail\n /tmp\n /usr\n /tmp\n /var/spool/mail\n" full_name: Dir::chdir is_singleton: true name: chdir params: | Dir.chdir( [ string] ) => 0 Dir.chdir( [ string] ) {| path | block } => anObject visibility: public