             child.on 'exit', (code) ->
                 if code == 0
                     console.log "Created #{target} (#{packageName})"
-                    done()
                 else
-                    console.log "Possible problem with #{target} #{packageName} " +
-                        "-- (exit with #{code})"
-                    done()
+                    console.log "Possible problem with #{target} " +
+                        "(exit with code #{code})"
+                    console.log 'fpm arguments: ' + fpmArgs.join(' ')
                     process.exit(1)
-        names['linux'].push 'deploy:linux-' + arch + ':' + target
-        allNames.push('deploy:linux-' + arch + ':' + target)
+            return child
+        #names['linux'].push 'deploy:linux-' + arch + ':' + target
+        #allNames.push('deploy:linux-' + arch + ':' + target)
 
     gulp.task 'deploy:linux-' + arch + ':flatpak', (done) ->
         flatpakOptions =

                "./src/icons/icon_#{src}.png=/usr/share/icons/hicolor/#{size}x#{size}/apps/#{json.name}.png"
            fpmArgs = [
                '-s', 'dir'
                '--loglevel', 'debug'
                '-t', target
                '--architecture', archName
                '--rpm-os', 'linux'
                '--name', json.name
                '--force' # Overwrite existing files
                '--license', json.license
                '--description', json.description
                '--url', json.homepage
                '--maintainer', json.author
                '--vendor', json.authorName
                '--version', json.version
                '--package', "./dist/#{packageName}"
                '--after-install', './resources/linux/after-install.sh'

                console.log "Created flatpak (#{json.name}_#{json.version}_#{arch}.flatpak)"
                done()

    #names['linux'].push 'deploy:linux-' + arch + ':flatpak'
    #allNames.push('deploy:linux-' + arch + ':flatpak')

# create tasks for different platforms and architectures supported
platformOpts.map (plat) ->
