From 33e78a589e31ec90f81c688b5e12bbbf3101d04e Mon Sep 17 00:00:00 2001 From: Jonathan Rainville Date: Fri, 25 May 2018 13:48:56 -0400 Subject: [PATCH] add error if user uses ipfs 0.4.14 or lower --- lib/processes/storageProcesses/ipfs.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/lib/processes/storageProcesses/ipfs.js b/lib/processes/storageProcesses/ipfs.js index dba1b62f8..465912221 100644 --- a/lib/processes/storageProcesses/ipfs.js +++ b/lib/processes/storageProcesses/ipfs.js @@ -8,9 +8,27 @@ class IPFSProcess extends ProcessWrapper { constructor(_options) { super(); + this.checkIPFSVersion(); this.startIPFSDaemon(); } + checkIPFSVersion() { + shelljs.exec('ipfs --version', {silent: true}, (err, stdout, _stderr) => { + if (err) { + console.error(err); + return; + } + const match = stdout.match(/[0-9]+\.[0-9]+\.[0-9]+/); + if (match[0]) { + const versions = match[0].split('.'); + if (versions[0] <= 0 && versions[1] <= 4 && versions[2] <= 15) { + console.error(`You are using IPFS version ${match[0]} which has an issue with processes.`); + console.error(`Please update to IPFS version 0.4.15 or more recent: https://github.com/ipfs/ipfs-update`); + } + } + }); + } + startIPFSDaemon() { const self = this; const child = shelljs.exec('ipfs daemon', {silent: true}, (err, _stdout, _stderr) => {