size_t length = StringBytes::Size(isolate, string, enc);
- Local<Object> buf = New(length);
+ Local<Object> buf = New(isolate, length);
char* data = Buffer::Data(buf);
StringBytes::Write(isolate, data, length, string, enc);
size_t size;
req->return_memory(&data, &size);
argv[0] = Null(req->env()->isolate());
- argv[1] = Buffer::Use(data, size);
+ argv[1] = Buffer::Use(req->env()->isolate(), data, size);
}
}
}
-Local<Object> SyncProcessStdioPipe::GetOutputAsBuffer() const {
+Local<Object> SyncProcessStdioPipe::GetOutputAsBuffer(Isolate* isolate) const {
size_t length = OutputLength();
- Local<Object> js_buffer = Buffer::New(length);
+ Local<Object> js_buffer = Buffer::New(isolate, length);
CopyOutput(Buffer::Data(js_buffer));
return js_buffer;
}
for (uint32_t i = 0; i < stdio_count_; i++) {
SyncProcessStdioPipe* h = stdio_pipes_[i];
if (h != nullptr && h->writable())
- js_output->Set(i, h->GetOutputAsBuffer());
+ js_output->Set(i, h->GetOutputAsBuffer(env()->isolate()));
else
js_output->Set(i, Null(env()->isolate()));
}
int Start();
void Close();
- Local<Object> GetOutputAsBuffer() const;
+ Local<Object> GetOutputAsBuffer(Isolate* isolate) const;
inline bool readable() const;
inline bool writable() const;
return;
// Allocate enough space to include the null terminator
- size_t len = StringBytes::StorageSize(string, UTF8) + 1;
+ size_t len = StringBytes::StorageSize(isolate, string, UTF8) + 1;
if (len > sizeof(str_st_)) {
str_ = static_cast<char*>(malloc(len));
CHECK_NE(str_, nullptr);