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,6 +124,9 @@ class Console::CommandDispatcher::Stdapi::Fs
return true
end
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?
@ -131,6 +134,7 @@ class Console::CommandDispatcher::Stdapi::Fs
end
fd.close
end
true
end