{"action":"closed","issue":{"url":"https://api.github.com/repos/dthree/vorpal/issues/20","labels_url":"https://api.github.com/repos/dthree/vorpal/issues/20/labels{/name}","comments_url":"https://api.github.com/repos/dthree/vorpal/issues/20/comments","events_url":"https://api.github.com/repos/dthree/vorpal/issues/20/events","html_url":"https://github.com/dthree/vorpal/issues/20","id":111087285,"number":20,"title":"Errors in actions are hidden","user":{"login":"DavertMik","id":220264,"avatar_url":"https://avatars.githubusercontent.com/u/220264?v=3","gravatar_id":"","url":"https://api.github.com/users/DavertMik","html_url":"https://github.com/DavertMik","followers_url":"https://api.github.com/users/DavertMik/followers","following_url":"https://api.github.com/users/DavertMik/following{/other_user}","gists_url":"https://api.github.com/users/DavertMik/gists{/gist_id}","starred_url":"https://api.github.com/users/DavertMik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DavertMik/subscriptions","organizations_url":"https://api.github.com/users/DavertMik/orgs","repos_url":"https://api.github.com/users/DavertMik/repos","events_url":"https://api.github.com/users/DavertMik/events{/privacy}","received_events_url":"https://api.github.com/users/DavertMik/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-10-13T01:49:37Z","updated_at":"2015-10-13T07:35:02Z","closed_at":"2015-10-13T07:35:02Z","body":"Can't trace errors while running commands in non-interactive shell\r\n\r\n@dthree \r\n> Figured it out. `.exec` was intended to be programmatic, so it eats teh error and returns it in exec's callback.\r\n`.parse` calls `.exec`, so it eats the error when invoked through .parse, but not otherwise.\r\n\r\n```javascript\r\n#!/usr/bin/env node\r\n\r\nvar program = require('vorpal')();\r\nvar path = require('path');\r\nvar fs = require('fs');\r\nvar colors = require('colors');\r\n\r\nvar error = colors.bgRed.white.bold;\r\n\r\nprogram.command('init [path]')\r\n  .description('Creates dummy config in current dir or [path]')\r\n  .action((args) => {\r\n    var path = args.path || '';\r\n    var configFile = path.join(process.cwd(), path, 'codecept.json');\r\n    this.log(path);\r\n    try {\r\n      fs.writeFileSync(configFile, '{}')\r\n    } catch (err) {\r\n      this.log(error(`File can't be created at ${configFile}`));\r\n      program.exit();\r\n    }\r\n    this.log(`Config created at ${configFile}`);\r\n  });\r\n\r\nprogram.parse(process.argv);\r\n```"}}