Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(130)

Unified Diff: src/d8-posix.cc

Issue 1602023: Add os.unsetenv to d8. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 10 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/d8.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/d8-posix.cc
===================================================================
--- src/d8-posix.cc (revision 4385)
+++ src/d8-posix.cc (working copy)
@@ -663,10 +663,27 @@
}
+Handle<Value> Shell::UnsetEnvironment(const Arguments& args) {
+ if (args.Length() != 1) {
+ const char* message = "unsetenv() takes one argument";
+ return ThrowException(String::New(message));
+ }
+ String::Utf8Value var(args[0]);
+ if (*var == NULL) {
+ const char* message =
+ "os.setenv(): String conversion of variable name failed.";
+ return ThrowException(String::New(message));
+ }
+ unsetenv(*var);
+ return v8::Undefined();
+}
+
+
void Shell::AddOSMethods(Handle<ObjectTemplate> os_templ) {
os_templ->Set(String::New("system"), FunctionTemplate::New(System));
os_templ->Set(String::New("chdir"), FunctionTemplate::New(ChangeDirectory));
os_templ->Set(String::New("setenv"), FunctionTemplate::New(SetEnvironment));
+ os_templ->Set(String::New("unsetenv"), FunctionTemplate::New(UnsetEnvironment));
Søren Thygesen Gjesse 2010/04/13 07:31:45 Long line.
os_templ->Set(String::New("umask"), FunctionTemplate::New(SetUMask));
os_templ->Set(String::New("mkdirp"), FunctionTemplate::New(MakeDirectory));
os_templ->Set(String::New("rmdir"), FunctionTemplate::New(RemoveDirectory));
« no previous file with comments | « src/d8.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698