Skip to content
This repository was archived by the owner on Feb 12, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/cli/commands/daemon.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
'use strict'

const os = require('os')
const { getRepoPath, print, ipfsPathHelp } = require('../utils')

module.exports = {
Expand Down Expand Up @@ -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()

Expand Down
23 changes: 23 additions & 0 deletions test/cli/daemon.js
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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}`)
})
})