mirror of
https://github.com/embarklabs/embark.git
synced 2025-01-19 02:03:14 +00:00
fix(gethClient): clear timeout when call backing
This commit is contained in:
parent
b20bce9880
commit
9a6149fef7
@ -225,12 +225,22 @@ class GethClient {
|
|||||||
|
|
||||||
initDevChain(datadir, callback) {
|
initDevChain(datadir, callback) {
|
||||||
exec(this.listAccountsCommand(), {}, (err, stdout, _stderr) => {
|
exec(this.listAccountsCommand(), {}, (err, stdout, _stderr) => {
|
||||||
|
const readyTimeout = setTimeout(() => {
|
||||||
|
this.child.kill();
|
||||||
|
return cb(__('Geth dev command never returned a developer account'));
|
||||||
|
}, 10 * 1000);
|
||||||
|
|
||||||
|
function cb(err) {
|
||||||
|
clearTimeout(readyTimeout);
|
||||||
|
callback(err);
|
||||||
|
}
|
||||||
|
|
||||||
if (err || stdout === undefined || stdout.indexOf("Fatal") >= 0) {
|
if (err || stdout === undefined || stdout.indexOf("Fatal") >= 0) {
|
||||||
return callback(err || stdout);
|
return cb(err || stdout);
|
||||||
}
|
}
|
||||||
this.config.unlockAddressList = this.parseListAccountsCommandResultToAddressList(stdout);
|
this.config.unlockAddressList = this.parseListAccountsCommandResultToAddressList(stdout);
|
||||||
if (this.config.unlockAddressList.length) {
|
if (this.config.unlockAddressList.length) {
|
||||||
return callback();
|
return cb();
|
||||||
}
|
}
|
||||||
|
|
||||||
// No accounts. We need to run the geth --dev command for it to create the dev account
|
// No accounts. We need to run the geth --dev command for it to create the dev account
|
||||||
@ -243,14 +253,9 @@ class GethClient {
|
|||||||
data = data.toString();
|
data = data.toString();
|
||||||
if (data.indexOf('Using developer account') > -1) {
|
if (data.indexOf('Using developer account') > -1) {
|
||||||
this.child.kill();
|
this.child.kill();
|
||||||
callback();
|
cb();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
setTimeout(() => {
|
|
||||||
this.child.kill();
|
|
||||||
return callback(__('Geth dev command never returned a developer account'));
|
|
||||||
}, 10 * 1000);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -341,8 +346,11 @@ class GethClient {
|
|||||||
accountAddress = address;
|
accountAddress = address;
|
||||||
}
|
}
|
||||||
if (accountAddress) {
|
if (accountAddress) {
|
||||||
if(!(self.config && self.config.account && self.config.account.password)){
|
if (!(self.config && self.config.account && self.config.account.password)) {
|
||||||
console.warn(__("\n===== Password needed =====\nPassword for account {{account}} not found. Unlocking this account may fail. Please ensure a password is specified in config/blockchain.js > {{env}} > account > password.\n", {account: address, env: self.env}));
|
console.warn(__("\n===== Password needed =====\nPassword for account {{account}} not found. Unlocking this account may fail. Please ensure a password is specified in config/blockchain.js > {{env}} > account > password.\n", {
|
||||||
|
account: address,
|
||||||
|
env: self.env
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
args.push("--unlock=" + accountAddress);
|
args.push("--unlock=" + accountAddress);
|
||||||
return callback(null, "--unlock=" + accountAddress);
|
return callback(null, "--unlock=" + accountAddress);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user