             importer = new ProductUpdates resources.options
             processSftpImport(resources, importer, 'productUpdates')
           .then ->
-            @exitCode = 0
-          .fail (error) ->
-            logger.error error, 'Oops, something went wrong!'
-            logger.error error.stack if error.stack
-            @exitCode = 1
+            @_setExitCode 0
+          .fail (error) ->
+            logger.error error, 'Oops, something went wrong!'
+            logger.error error.stack if error.stack
+            @_setExitCode 1
         else # use command line arguments to load import/export files
           validateCredentialsOpts(opts, CONS.CMD_IMPORT_PRODUCTS_UPDATES)
           validateOpt(opts.products, 'products', CONS.CMD_IMPORT_PRODUCTS_UPDATES)

      .option '--categories [file]', 'XML file containing categories to import'
      .option '--safeCreate', 'If defined, importer will check for product existence (by ProductId attribute mapping) in SPHERE.IO before sending create new product request'
      .usage '--projectKey <project-key> --clientId <client-id> --clientSecret <client-secret> --mapping <file> --config [file] --products <file> --manufacturers [file] --categories [file]'
      .action (opts) ->

        validateGlobalOpts(opts, CONS.CMD_IMPORT_PRODUCTS)
        logger = createLogger(opts)

            .then (result) ->
              importer = new Products resources.options
              processSftpImport(resources, importer, 'products')
          .then =>
            @_setExitCode 0
          .fail (error) =>
            logger.error error, 'Oops, something went wrong!'
            logger.error error.stack if error.stack
            @_setExitCode 1
        else # use command line arguments to load import/export files
          validateCredentialsOpts(opts, CONS.CMD_IMPORT_PRODUCTS)
          validateOpt(opts.products, 'products', CONS.CMD_IMPORT_PRODUCTS)
