From 90c5f39e9f7acd68e27542cbd777c63e057e3ad6 Mon Sep 17 00:00:00 2001 From: ooooooo-q Date: Sun, 12 Mar 2017 16:31:29 +0900 Subject: [PATCH] exec -> spawn --- quickstarts/thumbnails/functions/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/quickstarts/thumbnails/functions/index.js b/quickstarts/thumbnails/functions/index.js index 2f40be9..9ec697b 100644 --- a/quickstarts/thumbnails/functions/index.js +++ b/quickstarts/thumbnails/functions/index.js @@ -18,7 +18,7 @@ // [START import] const functions = require('firebase-functions'); const gcs = require('@google-cloud/storage')(); -const exec = require('child-process-promise').exec; +const spawn = require('child-process-promise').spawn; // [END import] // [START generateThumbnail] @@ -69,7 +69,7 @@ exports.generateThumbnail = functions.storage.object().onChange(event => { }).then(() => { console.log('Image downloaded locally to', tempFilePath); // Generate a thumbnail using ImageMagick. - return exec(`convert "${tempFilePath}" -thumbnail '200x200>' "${tempFilePath}"`).then(() => { + return spawn('convert', [tempFilePath, '-thumbnail', '200x200>', tempFilePath]).then(() => { console.log('Thumbnail created at', tempFilePath); // We add a 'thumb_' prefix to thumbnails file name. That's where we'll upload the thumbnail. const thumbFilePath = filePath.replace(/(\/)?([^\/]*)$/, `$1thumb_$2`);