Skip to content

Commit 81c14b7

Browse files
author
John Haley
committed
Made cred callbacks async again
1 parent 6ed5c38 commit 81c14b7

2 files changed

Lines changed: 3 additions & 13 deletions

File tree

generate/descriptor.json

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -253,9 +253,6 @@
253253
"cred": {
254254
"cType": "git_cred",
255255
"functions": {
256-
"git_cred_default_new":{
257-
"isAsync": false
258-
},
259256
"git_cred_ssh_custom_new": {
260257
"ignore": true
261258
},
@@ -265,14 +262,8 @@
265262
"git_cred_ssh_key_from_agent":{
266263
"isAsync": false
267264
},
268-
"git_cred_ssh_key_new":{
269-
"isAsync": false
270-
},
271265
"git_cred_userpass": {
272266
"ignore": true
273-
},
274-
"git_cred_userpass_plaintext_new": {
275-
"isAsync": false
276267
}
277268
}
278269
},

generate/partials/field_accessors.cc

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,11 +133,10 @@ void {{ cppClassName }}::{{ field.name }}_asyncAfter(uv_work_t* req, int status)
133133
TryCatch tryCatch;
134134
Handle<Value> result = instance->{{ field.name }}->Call({{ field.args|jsArgsCount }}, argv);
135135

136-
if (result->IsObject()) {
137-
const char* constructorName = **(new NanUtf8String(result->ToObject()->GetConstructorName()));
138-
string promiseConName ("Promise");
136+
if (result->IsObject() && result->ToObject()->Has(NanNew("then"))) {
137+
Handle<Value> thenProp = result->ToObject()->Get(NanNew("then"));
139138

140-
if (promiseConName.compare(constructorName) == 0) {
139+
if (thenProp->IsFunction()) {
141140
// we can be reasonbly certain that the result is a promise
142141
Local<Object> promise = result->ToObject();
143142

0 commit comments

Comments
 (0)