Check return code from fwrite

BUG=http://code.google.com/p/v8/issues/detail?id=453
TEST=none
Review URL: http://codereview.chromium.org/458016

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3404 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
sgjesse@chromium.org 2009-12-03 08:48:32 +00:00
parent d84d47961a
commit 14066c0e0e

View File

@ -159,7 +159,11 @@ Handle<Value> Shell::Write(const Arguments& args) {
printf(" ");
}
v8::String::Utf8Value str(args[i]);
fwrite(*str, sizeof(**str), str.length(), stdout);
int n = fwrite(*str, sizeof(**str), str.length(), stdout);
if (n != str.length()) {
printf("Error in fwrite\n");
exit(1);
}
}
return Undefined();
}
@ -203,7 +207,7 @@ Handle<Value> Shell::Load(const Arguments& args) {
return ThrowException(String::New("Error loading file"));
}
if (!ExecuteString(source, String::New(*file), false, false)) {
return ThrowException(String::New("Error executing file"));
return ThrowException(String::New("Error executing file"));
}
}
return Undefined();