Print an error when trying to open a dir as a file

Prevents unnecessary stack traces
unstable
James Lee 2012-04-05 11:38:44 -06:00
parent 0c3f1aab77
commit 585245501a
1 changed files with 9 additions and 5 deletions

View File

@ -124,14 +124,18 @@ class Console::CommandDispatcher::Stdapi::Fs
return true
end
fd = client.fs.file.new(args[0], "rb")
if (client.fs.stat(args[0]).directory?)
print_error("#{args[0]} is a directory")
else
fd = client.fs.file.new(args[0], "rb")
until fd.eof?
print(fd.read)
until fd.eof?
print(fd.read)
end
fd.close
end
fd.close
true
end