Skip to content

Commit d49274f

Browse files
committed
fix string related bug in headless
1 parent 69eaa6e commit d49274f

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/headlessutils.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
#include "headlessutils.h"
1919
#include <iostream>
20+
#include <string>
2021
#include "nan.h"
2122
#include "uv.h"
2223

@@ -31,12 +32,13 @@ void setZipFunction(Nan::Callback* zF) {
3132
uv_async_t async_zip;
3233

3334
uv_loop_t* loop;
34-
const char* outputDir;
35+
std::string outputDir;
3536

3637
void asyncfunc(uv_async_t* handle) {
3738
Nan::HandleScope scope;
3839
v8::Isolate* isolate = v8::Isolate::GetCurrent();
39-
v8::Local<v8::Value> argv[] = { v8::String::NewFromUtf8(isolate, outputDir) };
40+
printf("outputdir in asyncfunc is %s\n", outputDir.c_str());
41+
v8::Local<v8::Value> argv[] = { v8::String::NewFromUtf8(isolate, outputDir.c_str()) };
4042
headless::zipFunction->Call(1, argv);
4143
}
4244

@@ -53,7 +55,8 @@ void stop() {
5355
}
5456

5557
void zip(const char* dir) {
56-
outputDir = dir;
58+
printf("Headless utils: Outputdir = %s\n", dir);
59+
outputDir = std::string(dir);
5760
uv_async_send(&async_zip);
5861
}
5962

0 commit comments

Comments
 (0)