Method: Linebook::Os::Posix::Utilities#cd
- Defined in:
- lib/linebook/os/posix/utilities.rb
#cd(directory = nil, options = {}) ⇒ Object
Change the working directory, for the duration of a block if given. [Spec]
36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/linebook/os/posix/utilities.rb', line 36 def cd(directory=nil, ={}) if block_given? var = _package_.next_variable_name('cd') writeln %{#{var}=$(pwd)} end execute 'cd', directory, if block_given? yield execute 'cd', "$#{var}" end chain_proxy end |