diff --git a/src/cli/commands/daemon.js b/src/cli/commands/daemon.js index 0377f92b96..8e254164bb 100644 --- a/src/cli/commands/daemon.js +++ b/src/cli/commands/daemon.js @@ -1,5 +1,6 @@ 'use strict' +const os = require('os') const { getRepoPath, print, ipfsPathHelp } = require('../utils') module.exports = { @@ -35,6 +36,9 @@ module.exports = { handler (argv) { argv.resolve((async () => { print('Initializing IPFS daemon...') + print(`js-ipfs version: ${require('../../../package.json').version}`) + print(`System version: ${os.arch()}/${os.platform()}`) + print(`Node.js version: ${process.versions.node}`) const repoPath = getRepoPath() diff --git a/test/cli/daemon.js b/test/cli/daemon.js index a9aaccacf0..4df3198d19 100644 --- a/test/cli/daemon.js +++ b/test/cli/daemon.js @@ -9,6 +9,7 @@ const os = require('os') const path = require('path') const hat = require('hat') const fs = require('fs') +const pkg = require('../../package.json') const skipOnWindows = isWindows() ? it.skip : it @@ -149,4 +150,26 @@ describe('daemon', () => { done() }) }) + + it('should print version info', async () => { + await ipfs('init') + + const out = await new Promise(resolve => { + const res = ipfs('daemon') + let out = '' + + res.stdout.on('data', function onData (data) { + out += data + if (out.includes('Daemon is ready')) { + res.stdout.removeListener('data', onData) + res.kill() + resolve(out) + } + }) + }) + + expect(out).to.include(`js-ipfs version: ${pkg.version}`) + expect(out).to.include(`System version: ${os.arch()}/${os.platform()}`) + expect(out).to.include(`Node.js version: ${process.versions.node}`) + }) })