diff --git a/.gitignore b/.gitignore index 4b1cc92..42415e0 100644 --- a/.gitignore +++ b/.gitignore @@ -5,8 +5,8 @@ release-builds /.gitignore /package-lock.json build/ -dist/ script.sh /Mac_Distribution_Provisioning_Profiles_.provisionprofile !/build/ /electron-builder.yml +/dist/ diff --git a/README.md b/README.md index 0ae1998..9128f5f 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ The original graphic will be not replaced. ## Download and Installation on MacOsX Download Image Shrinker here: -https://github.com/stefansl/image-shrinker/releases/download/v1.3.0/image-shrinker-1.3.0.dmg +https://github.com/stefansl/image-shrinker/releases/download/v1.3.1/image-shrinker-1.3.1.dmg Unpack and copy or drag the app into your MacOSX application folder. For uninstalling, just drop the app into the bin. diff --git a/main.js b/main.js index 1279fdd..c3f2349 100644 --- a/main.js +++ b/main.js @@ -6,7 +6,7 @@ const fs = require('fs'); const path = require('path'); const settings = require('electron-settings'); const svgo = require('svgo'); -const spawn = require('child_process').spawn; +const execFile = require('child_process').execFile; const mozjpeg = require('mozjpeg'); const pngquant = require('pngquant-bin'); const makeDir = require('make-dir'); @@ -158,32 +158,18 @@ let processFile = (filePath, fileName) => { } case '.jpg': case '.jpeg': { - let jpg = spawn(mozjpeg, ['-outfile', newFile, filePath]); - jpg.stdout.on('data', (data) => { - log.info('stdout: ' + data.toString()); - }); - jpg.on('close', () => { + execFile(mozjpeg, ['-outfile', newFile, filePath], (err) => { touchBarResult.label = 'Your shrinked image: ' + newFile; sendToRenderer(err, newFile, sizeOrig); }); - jpg.on('exit', (code) => { - log.info('child process exited with code ' + code.toString()); - }); break; } case '.png': { - let png = spawn(pngquant, ['-fo', newFile, filePath]); - png.stdout.on('data', (data) => { - log.info('stdout: ' + data.toString()); - }); - png.on('close', () => { + execFile(pngquant, ['-fo', newFile, filePath], (err) => { touchBarResult.label = 'Your shrinked image: ' + newFile; sendToRenderer(err, newFile, sizeOrig); }); - png.on('exit', (code) => { - log.info('child process exited with code ' + code.toString()); - }); break; } default: diff --git a/package.json b/package.json index a656851..c25124b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "image-shrinker", - "version": "1.3.0", + "version": "1.3.1", "description": "GUI for minifying images", "main": "main.js", "title": "Image Shrinker",