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

Side by Side Diff: src/d8-posix.cc

Issue 119013004: Revert "More API cleanup." (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/api.cc ('k') | src/extensions/statistics-extension.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2009 the V8 project authors. All rights reserved. 1 // Copyright 2009 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 "os.system(): String conversion of program name failed"; 195 "os.system(): String conversion of program name failed";
196 isolate->ThrowException(String::NewFromUtf8(isolate, message)); 196 isolate->ThrowException(String::NewFromUtf8(isolate, message));
197 return false; 197 return false;
198 } 198 }
199 int len = prog.length() + 3; 199 int len = prog.length() + 3;
200 char* c_arg = new char[len]; 200 char* c_arg = new char[len];
201 snprintf(c_arg, len, "%s", *prog); 201 snprintf(c_arg, len, "%s", *prog);
202 exec_args_[0] = c_arg; 202 exec_args_[0] = c_arg;
203 int i = 1; 203 int i = 1;
204 for (unsigned j = 0; j < command_args->Length(); i++, j++) { 204 for (unsigned j = 0; j < command_args->Length(); i++, j++) {
205 Handle<Value> arg(command_args->Get(Integer::New(isolate, j))); 205 Handle<Value> arg(command_args->Get(Integer::New(j)));
206 String::Utf8Value utf8_arg(arg); 206 String::Utf8Value utf8_arg(arg);
207 if (*utf8_arg == NULL) { 207 if (*utf8_arg == NULL) {
208 exec_args_[i] = NULL; // Consistent state for destructor. 208 exec_args_[i] = NULL; // Consistent state for destructor.
209 const char* message = 209 const char* message =
210 "os.system(): String conversion of argument failed."; 210 "os.system(): String conversion of argument failed.";
211 isolate->ThrowException(String::NewFromUtf8(isolate, message)); 211 isolate->ThrowException(String::NewFromUtf8(isolate, message));
212 return false; 212 return false;
213 } 213 }
214 int len = utf8_arg.length() + 1; 214 int len = utf8_arg.length() + 1;
215 char* c_arg = new char[len]; 215 char* c_arg = new char[len];
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 } 307 }
308 308
309 309
310 // Accumulates the output from the child in a string handle. Returns true if it 310 // Accumulates the output from the child in a string handle. Returns true if it
311 // succeeded or false if an exception was thrown. 311 // succeeded or false if an exception was thrown.
312 static Handle<Value> GetStdout(Isolate* isolate, 312 static Handle<Value> GetStdout(Isolate* isolate,
313 int child_fd, 313 int child_fd,
314 struct timeval& start_time, 314 struct timeval& start_time,
315 int read_timeout, 315 int read_timeout,
316 int total_timeout) { 316 int total_timeout) {
317 Handle<String> accumulator = String::Empty(isolate); 317 Handle<String> accumulator = String::Empty();
318 318
319 int fullness = 0; 319 int fullness = 0;
320 static const int kStdoutReadBufferSize = 4096; 320 static const int kStdoutReadBufferSize = 4096;
321 char buffer[kStdoutReadBufferSize]; 321 char buffer[kStdoutReadBufferSize];
322 322
323 if (fcntl(child_fd, F_SETFL, O_NONBLOCK) != 0) { 323 if (fcntl(child_fd, F_SETFL, O_NONBLOCK) != 0) {
324 return isolate->ThrowException( 324 return isolate->ThrowException(
325 String::NewFromUtf8(isolate, strerror(errno))); 325 String::NewFromUtf8(isolate, strerror(errno)));
326 } 326 }
327 327
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after
732 FunctionTemplate::New(isolate, UnsetEnvironment)); 732 FunctionTemplate::New(isolate, UnsetEnvironment));
733 os_templ->Set(String::NewFromUtf8(isolate, "umask"), 733 os_templ->Set(String::NewFromUtf8(isolate, "umask"),
734 FunctionTemplate::New(isolate, SetUMask)); 734 FunctionTemplate::New(isolate, SetUMask));
735 os_templ->Set(String::NewFromUtf8(isolate, "mkdirp"), 735 os_templ->Set(String::NewFromUtf8(isolate, "mkdirp"),
736 FunctionTemplate::New(isolate, MakeDirectory)); 736 FunctionTemplate::New(isolate, MakeDirectory));
737 os_templ->Set(String::NewFromUtf8(isolate, "rmdir"), 737 os_templ->Set(String::NewFromUtf8(isolate, "rmdir"),
738 FunctionTemplate::New(isolate, RemoveDirectory)); 738 FunctionTemplate::New(isolate, RemoveDirectory));
739 } 739 }
740 740
741 } // namespace v8 741 } // namespace v8
OLDNEW
« no previous file with comments | « src/api.cc ('k') | src/extensions/statistics-extension.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698