Hi,
i use the system method on Windows like that =
Dir.chdir(CVSWORKSPACE) do
system(“T:/cvsnt/cvs.exe -d :pserver:testuser@cvs:d:/cvsrepos/test
commit -m ‘blabla’”)
end
How to redirect the ouptut from a system call to a file ?
Like f.e. C:>dir > Y:\output.txt in a cmd shell
I need to parse the output from
cvs -update command to get the new files before doing a commit.
Regards, Gilbert
How to redirect the ouptut from a system call to a file ?
system(“dir > myfile.txt”)
Harry
Rebhan, Gilbert:
I need to parse the output from
cvs -update command to get the new files before doing a commit.
output = command here
Note the use of backticks (), and note that only the command's stdout is redirected. For more complicated use there is IO.popen. Note furthermore that
is a method, which means that (hopefully) all you need to know
can
be found via
ri ‘`’
ri IO.popen
Regards, Kalman
Hi,
did it with =
newfiles=Array.new
Dir.chdir(CVSWORKSPACE)
pipe=IO.popen("…/cvs.exe -d
:pserver:#{ENV[“USERNAME”]}@cvsprod:d:/cvsrepos/test update")
p pipe.readlines.each { |x|
newfiles<<’.’<<’/’<<x[2…-2]<<’ ’ }
puts newfiles.to_s
./subfolder1/file4.txt ./subfolder1/file5.txt
Recommended or is there a better way ?