make py calls sync; return correct value
This commit is contained in:
parent
27c2ab4104
commit
7ea590895f
|
@ -21,6 +21,7 @@
|
||||||
"grunt-cli": "^0.1.13",
|
"grunt-cli": "^0.1.13",
|
||||||
"matchdep": "^0.3.0",
|
"matchdep": "^0.3.0",
|
||||||
"python": "^0.0.4",
|
"python": "^0.0.4",
|
||||||
"methodmissing": "^0.0.3"
|
"methodmissing": "^0.0.3",
|
||||||
|
"sync-me": "^0.1.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,9 +2,11 @@ var python = require('python').shell;
|
||||||
var web3 = require('web3');
|
var web3 = require('web3');
|
||||||
var fs = require('fs');
|
var fs = require('fs');
|
||||||
var mm = require('methodmissing');
|
var mm = require('methodmissing');
|
||||||
|
var sync = require('sync-me');
|
||||||
|
|
||||||
py_exec = function(cmd) {
|
py_exec = function(cmd) {
|
||||||
python(cmd, function() {});
|
console.log("python: " + cmd);
|
||||||
|
return sync(python, cmd)[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
py_exec("from ethertdd import EvmContract")
|
py_exec("from ethertdd import EvmContract")
|
||||||
|
@ -39,10 +41,9 @@ TestContractWrapper = (function() {
|
||||||
arg_list.push(value);
|
arg_list.push(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(this.className + "_contract." + method + "(" + arg_list.join(",") + ")")
|
data = py_exec(this.className + "_contract." + method + "(" + arg_list.join(",") + ")");
|
||||||
python(this.className + "_contract." + method + "(" + arg_list.join(",") + ")", function(err, data) {
|
console.log("res: " + data);
|
||||||
console.log("res: " + data);
|
return data;
|
||||||
})
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return TestContractWrapper;
|
return TestContractWrapper;
|
||||||
|
@ -52,7 +53,7 @@ TestContractWrapper = (function() {
|
||||||
TestContract = function(contract, className) {
|
TestContract = function(contract, className) {
|
||||||
var wrapper = new TestContractWrapper(contract, className);
|
var wrapper = new TestContractWrapper(contract, className);
|
||||||
var Obj = mm(wrapper, function (key, args) {
|
var Obj = mm(wrapper, function (key, args) {
|
||||||
wrapper.execCmd(key, args)
|
return wrapper.execCmd(key, args);
|
||||||
});
|
});
|
||||||
return Obj;
|
return Obj;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue