Removes the data directory when the tor process exits
This commit is contained in:
parent
369ffa5d4f
commit
bfde78268a
|
@ -23,7 +23,7 @@ class TorProcess extends EventEmitter {
|
||||||
|
|
||||||
exit(callback) {
|
exit(callback) {
|
||||||
this.process.once('exit', (code) => {
|
this.process.once('exit', (code) => {
|
||||||
del(this.tor_config.DataDirectory).then(() => callback && callback(null, code)).catch((error) => callback && callback(error, code));
|
callback && callback(null, code);
|
||||||
});
|
});
|
||||||
this.process.kill('SIGKILL');
|
this.process.kill('SIGKILL');
|
||||||
}
|
}
|
||||||
|
@ -73,6 +73,10 @@ class TorProcess extends EventEmitter {
|
||||||
shell: '/bin/bash'
|
shell: '/bin/bash'
|
||||||
});
|
});
|
||||||
|
|
||||||
|
tor.on('exit', () => {
|
||||||
|
del.sync(this.tor_config.DataDirectory);
|
||||||
|
});
|
||||||
|
|
||||||
tor.stderr.on('data', (data) => {
|
tor.stderr.on('data', (data) => {
|
||||||
let error_message = Buffer.from(data).toString('utf8');
|
let error_message = Buffer.from(data).toString('utf8');
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue