From 70cc06b18e8d5f0ec5d4fa10c2c6ae54bc5d0ce0 Mon Sep 17 00:00:00 2001 From: Gibson Fahnestock Date: Mon, 2 Oct 2017 10:00:04 +0100 Subject: [PATCH] Fix cb is not a function error in idt:install Callback is optional, so should only be called if passed in. --- app/templates/idt.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/templates/idt.js b/app/templates/idt.js index 162a99d..b22a168 100644 --- a/app/templates/idt.js +++ b/app/templates/idt.js @@ -58,7 +58,7 @@ function runIDT(args) { cp.execSync(cmd, {stdio: 'inherit'}); } -// Download the IDT installer script and trigger runIDT(). +// Download the IDT installer script and trigger runInstaller(). function downloadInstaller(cb) { const url = win ? 'https://ibm.biz/yeoman-idt-win-install' : @@ -77,7 +77,7 @@ function downloadInstaller(cb) { .on('finish', () => runInstaller(fileName, cb)); } -// Run the installer script and trigger callback (cb). +// Run the installer script and trigger optional callback (cb). function runInstaller(fileName, cb) { const shell = win ? 'powershell.exe' : 'bash'; @@ -85,5 +85,5 @@ function runInstaller(fileName, cb) { console.log(`Now running: ${shell} ${filePath}`); cp.spawnSync(shell, [filePath], {stdio: 'inherit'}); - cb(); + typeof cb === 'function' && cb(); }