{"action":"created","comment":{"url":"https://api.github.com/repos/apparatus/fuge/pulls/comments/57315192","id":57315192,"diff_hunk":"@@ -298,39 +332,47 @@ module.exports = function() {\n \n   var inputStructure = function(command, type, description, action, system){\n     // structures the commands and creates the vorpal instances\n+    var cmd;\n     if (type !== null){\n-      vorpal\n-      .command(command + type)\n-      .autocomplete(procList)\n-      .description(description)\n-      .action(function (args, cb) {\n-        var opt = args.process; // optional argument\n-        var arr = [command];\n-          if (command === 'send'){\n-            if (opt !== undefined){\n-              for (var i=0; i<opt.length; i++){\n-              arr.push(opt[i]);\n+      cmd = vorpal\n+        .command(command + type)\n+        .autocomplete(procList)\n+        .description(description)\n+        .action(function (args, cb) {\n+          if (command === 'profile') {\n+            return action(args, system, cb);\n+          }\n+          var opt = args.process; // optional argument\n+          var arr = [command];\n+            if (command === 'send'){\n+              if (opt !== undefined){\n+                for (var i=0; i<opt.length; i++){","path":"shell.js","position":86,"original_position":86,"commit_id":"bc4a9baead4c59cd4c0b6ab680134d2564cec368","original_commit_id":"bc4a9baead4c59cd4c0b6ab680134d2564cec368","user":{"login":"davidmarkclements","id":1190716,"avatar_url":"https://avatars.githubusercontent.com/u/1190716?v=3","gravatar_id":"","url":"https://api.github.com/users/davidmarkclements","html_url":"https://github.com/davidmarkclements","followers_url":"https://api.github.com/users/davidmarkclements/followers","following_url":"https://api.github.com/users/davidmarkclements/following{/other_user}","gists_url":"https://api.github.com/users/davidmarkclements/gists{/gist_id}","starred_url":"https://api.github.com/users/davidmarkclements/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davidmarkclements/subscriptions","organizations_url":"https://api.github.com/users/davidmarkclements/orgs","repos_url":"https://api.github.com/users/davidmarkclements/repos","events_url":"https://api.github.com/users/davidmarkclements/events{/privacy}","received_events_url":"https://api.github.com/users/davidmarkclements/received_events","type":"User","site_admin":false},"body":"yep - there's a semicolon at the end of the expression :bowtie: ","created_at":"2016-03-24T13:25:48Z","updated_at":"2016-03-24T13:25:48Z","html_url":"https://github.com/apparatus/fuge/pull/64#discussion_r57315192","pull_request_url":"https://api.github.com/repos/apparatus/fuge/pulls/64","_links":{"self":{"href":"https://api.github.com/repos/apparatus/fuge/pulls/comments/57315192"},"html":{"href":"https://github.com/apparatus/fuge/pull/64#discussion_r57315192"},"pull_request":{"href":"https://api.github.com/repos/apparatus/fuge/pulls/64"}}},"pull_request":{"url":"https://api.github.com/repos/apparatus/fuge/pulls/64","id":63969095,"html_url":"https://github.com/apparatus/fuge/pull/64","diff_url":"https://github.com/apparatus/fuge/pull/64.diff","patch_url":"https://github.com/apparatus/fuge/pull/64.patch","issue_url":"https://api.github.com/repos/apparatus/fuge/issues/64","number":64,"state":"open","locked":false,"title":"profile command","user":{"login":"davidmarkclements","id":1190716,"avatar_url":"https://avatars.githubusercontent.com/u/1190716?v=3","gravatar_id":"","url":"https://api.github.com/users/davidmarkclements","html_url":"https://github.com/davidmarkclements","followers_url":"https://api.github.com/users/davidmarkclements/followers","following_url":"https://api.github.com/users/davidmarkclements/following{/other_user}","gists_url":"https://api.github.com/users/davidmarkclements/gists{/gist_id}","starred_url":"https://api.github.com/users/davidmarkclements/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davidmarkclements/subscriptions","organizations_url":"https://api.github.com/users/davidmarkclements/orgs","repos_url":"https://api.github.com/users/davidmarkclements/repos","events_url":"https://api.github.com/users/davidmarkclements/events{/privacy}","received_events_url":"https://api.github.com/users/davidmarkclements/received_events","type":"User","site_admin":false},"body":"uses [0x](http://npm.im/0x) to profile a process, generating a flamegraph when the process has stopped\r\n\r\nusage:\r\n```\r\nfuge> profile service1\r\n(hit service with some work)\r\nfuge> stop service\r\nstopping: service1\r\nsending SIGINT to  child process: 50984\r\nsending SIGINT to  child process: 50985\r\nsending SIGINT to  child process: 50986\r\nsending SIGINT to  parent process: 50981\r\n[service1 - 50981]: file:///Users/davidclements/z/nearForm/fuge/tst/service1/profile-50984/flamegraph.html\r\n```\r\n\r\nps output of a profiled process:\r\n\r\n```\r\nname                           type            status          watch           tail            count\r\nfrontend                       process         stopped         yes             yes             0\r\nservice1                       process         profiling       no              yes             1\r\nservice2                       process         stopped         yes             yes             0\r\n```\r\n\r\nwatching is always turned off for profiled processes (they create an isolate-v8 log that causes an infinite watch-reload loop, also changing files and reloading defeats the purpose of a profiling period)\r\n\r\n\r\n\r\nthe bulk of the implementation is in the counterpart PR at apparatus/fuge-runner#6\r\n\r\n@pelger @AdrianRossouw @geek","created_at":"2016-03-23T23:27:35Z","updated_at":"2016-03-24T13:25:48Z","closed_at":null,"merged_at":null,"merge_commit_sha":"78d96cd4d8416336e037edf9a3dee628838dd4f7","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/apparatus/fuge/pulls/64/commits","review_comments_url":"https://api.github.com/repos/apparatus/fuge/pulls/64/comments","review_comment_url":"https://api.github.com/repos/apparatus/fuge/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apparatus/fuge/issues/64/comments","statuses_url":"https://api.github.com/repos/apparatus/fuge/statuses/bc4a9baead4c59cd4c0b6ab680134d2564cec368","head":{"label":"apparatus:profile","ref":"profile","sha":"bc4a9baead4c59cd4c0b6ab680134d2564cec368","user":{"login":"apparatus","id":15034360,"avatar_url":"https://avatars.githubusercontent.com/u/15034360?v=3","gravatar_id":"","url":"https://api.github.com/users/apparatus","html_url":"https://github.com/apparatus","followers_url":"https://api.github.com/users/apparatus/followers","following_url":"https://api.github.com/users/apparatus/following{/other_user}","gists_url":"https://api.github.com/users/apparatus/gists{/gist_id}","starred_url":"https://api.github.com/users/apparatus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apparatus/subscriptions","organizations_url":"https://api.github.com/users/apparatus/orgs","repos_url":"https://api.github.com/users/apparatus/repos","events_url":"https://api.github.com/users/apparatus/events{/privacy}","received_events_url":"https://api.github.com/users/apparatus/received_events","type":"Organization","site_admin":false},"repo":{"id":43944200,"name":"fuge","full_name":"apparatus/fuge","owner":{"login":"apparatus","id":15034360,"avatar_url":"https://avatars.githubusercontent.com/u/15034360?v=3","gravatar_id":"","url":"https://api.github.com/users/apparatus","html_url":"https://github.com/apparatus","followers_url":"https://api.github.com/users/apparatus/followers","following_url":"https://api.github.com/users/apparatus/following{/other_user}","gists_url":"https://api.github.com/users/apparatus/gists{/gist_id}","starred_url":"https://api.github.com/users/apparatus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apparatus/subscriptions","organizations_url":"https://api.github.com/users/apparatus/orgs","repos_url":"https://api.github.com/users/apparatus/repos","events_url":"https://api.github.com/users/apparatus/events{/privacy}","received_events_url":"https://api.github.com/users/apparatus/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/apparatus/fuge","description":"","fork":false,"url":"https://api.github.com/repos/apparatus/fuge","forks_url":"https://api.github.com/repos/apparatus/fuge/forks","keys_url":"https://api.github.com/repos/apparatus/fuge/keys{/key_id}","collaborators_url":"https://api.github.com/repos/apparatus/fuge/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/apparatus/fuge/teams","hooks_url":"https://api.github.com/repos/apparatus/fuge/hooks","issue_events_url":"https://api.github.com/repos/apparatus/fuge/issues/events{/number}","events_url":"https://api.github.com/repos/apparatus/fuge/events","assignees_url":"https://api.github.com/repos/apparatus/fuge/assignees{/user}","branches_url":"https://api.github.com/repos/apparatus/fuge/branches{/branch}","tags_url":"https://api.github.com/repos/apparatus/fuge/tags","blobs_url":"https://api.github.com/repos/apparatus/fuge/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/apparatus/fuge/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/apparatus/fuge/git/refs{/sha}","trees_url":"https://api.github.com/repos/apparatus/fuge/git/trees{/sha}","statuses_url":"https://api.github.com/repos/apparatus/fuge/statuses/{sha}","languages_url":"https://api.github.com/repos/apparatus/fuge/languages","stargazers_url":"https://api.github.com/repos/apparatus/fuge/stargazers","contributors_url":"https://api.github.com/repos/apparatus/fuge/contributors","subscribers_url":"https://api.github.com/repos/apparatus/fuge/subscribers","subscription_url":"https://api.github.com/repos/apparatus/fuge/subscription","commits_url":"https://api.github.com/repos/apparatus/fuge/commits{/sha}","git_commits_url":"https://api.github.com/repos/apparatus/fuge/git/commits{/sha}","comments_url":"https://api.github.com/repos/apparatus/fuge/comments{/number}","issue_comment_url":"https://api.github.com/repos/apparatus/fuge/issues/comments{/number}","contents_url":"https://api.github.com/repos/apparatus/fuge/contents/{+path}","compare_url":"https://api.github.com/repos/apparatus/fuge/compare/{base}...{head}","merges_url":"https://api.github.com/repos/apparatus/fuge/merges","archive_url":"https://api.github.com/repos/apparatus/fuge/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/apparatus/fuge/downloads","issues_url":"https://api.github.com/repos/apparatus/fuge/issues{/number}","pulls_url":"https://api.github.com/repos/apparatus/fuge/pulls{/number}","milestones_url":"https://api.github.com/repos/apparatus/fuge/milestones{/number}","notifications_url":"https://api.github.com/repos/apparatus/fuge/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/apparatus/fuge/labels{/name}","releases_url":"https://api.github.com/repos/apparatus/fuge/releases{/id}","deployments_url":"https://api.github.com/repos/apparatus/fuge/deployments","created_at":"2015-10-09T08:55:14Z","updated_at":"2016-03-22T19:42:36Z","pushed_at":"2016-03-23T23:27:35Z","git_url":"git://github.com/apparatus/fuge.git","ssh_url":"git@github.com:apparatus/fuge.git","clone_url":"https://github.com/apparatus/fuge.git","svn_url":"https://github.com/apparatus/fuge","homepage":null,"size":941,"stargazers_count":130,"watchers_count":130,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":17,"mirror_url":null,"open_issues_count":29,"forks":17,"open_issues":29,"watchers":130,"default_branch":"master"}},"base":{"label":"apparatus:master","ref":"master","sha":"7b44d99a2ba5af46c27b08bbe669e611511fd06a","user":{"login":"apparatus","id":15034360,"avatar_url":"https://avatars.githubusercontent.com/u/15034360?v=3","gravatar_id":"","url":"https://api.github.com/users/apparatus","html_url":"https://github.com/apparatus","followers_url":"https://api.github.com/users/apparatus/followers","following_url":"https://api.github.com/users/apparatus/following{/other_user}","gists_url":"https://api.github.com/users/apparatus/gists{/gist_id}","starred_url":"https://api.github.com/users/apparatus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apparatus/subscriptions","organizations_url":"https://api.github.com/users/apparatus/orgs","repos_url":"https://api.github.com/users/apparatus/repos","events_url":"https://api.github.com/users/apparatus/events{/privacy}","received_events_url":"https://api.github.com/users/apparatus/received_events","type":"Organization","site_admin":false},"repo":{"id":43944200,"name":"fuge","full_name":"apparatus/fuge","owner":{"login":"apparatus","id":15034360,"avatar_url":"https://avatars.githubusercontent.com/u/15034360?v=3","gravatar_id":"","url":"https://api.github.com/users/apparatus","html_url":"https://github.com/apparatus","followers_url":"https://api.github.com/users/apparatus/followers","following_url":"https://api.github.com/users/apparatus/following{/other_user}","gists_url":"https://api.github.com/users/apparatus/gists{/gist_id}","starred_url":"https://api.github.com/users/apparatus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apparatus/subscriptions","organizations_url":"https://api.github.com/users/apparatus/orgs","repos_url":"https://api.github.com/users/apparatus/repos","events_url":"https://api.github.com/users/apparatus/events{/privacy}","received_events_url":"https://api.github.com/users/apparatus/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/apparatus/fuge","description":"","fork":false,"url":"https://api.github.com/repos/apparatus/fuge","forks_url":"https://api.github.com/repos/apparatus/fuge/forks","keys_url":"https://api.github.com/repos/apparatus/fuge/keys{/key_id}","collaborators_url":"https://api.github.com/repos/apparatus/fuge/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/apparatus/fuge/teams","hooks_url":"https://api.github.com/repos/apparatus/fuge/hooks","issue_events_url":"https://api.github.com/repos/apparatus/fuge/issues/events{/number}","events_url":"https://api.github.com/repos/apparatus/fuge/events","assignees_url":"https://api.github.com/repos/apparatus/fuge/assignees{/user}","branches_url":"https://api.github.com/repos/apparatus/fuge/branches{/branch}","tags_url":"https://api.github.com/repos/apparatus/fuge/tags","blobs_url":"https://api.github.com/repos/apparatus/fuge/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/apparatus/fuge/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/apparatus/fuge/git/refs{/sha}","trees_url":"https://api.github.com/repos/apparatus/fuge/git/trees{/sha}","statuses_url":"https://api.github.com/repos/apparatus/fuge/statuses/{sha}","languages_url":"https://api.github.com/repos/apparatus/fuge/languages","stargazers_url":"https://api.github.com/repos/apparatus/fuge/stargazers","contributors_url":"https://api.github.com/repos/apparatus/fuge/contributors","subscribers_url":"https://api.github.com/repos/apparatus/fuge/subscribers","subscription_url":"https://api.github.com/repos/apparatus/fuge/subscription","commits_url":"https://api.github.com/repos/apparatus/fuge/commits{/sha}","git_commits_url":"https://api.github.com/repos/apparatus/fuge/git/commits{/sha}","comments_url":"https://api.github.com/repos/apparatus/fuge/comments{/number}","issue_comment_url":"https://api.github.com/repos/apparatus/fuge/issues/comments{/number}","contents_url":"https://api.github.com/repos/apparatus/fuge/contents/{+path}","compare_url":"https://api.github.com/repos/apparatus/fuge/compare/{base}...{head}","merges_url":"https://api.github.com/repos/apparatus/fuge/merges","archive_url":"https://api.github.com/repos/apparatus/fuge/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/apparatus/fuge/downloads","issues_url":"https://api.github.com/repos/apparatus/fuge/issues{/number}","pulls_url":"https://api.github.com/repos/apparatus/fuge/pulls{/number}","milestones_url":"https://api.github.com/repos/apparatus/fuge/milestones{/number}","notifications_url":"https://api.github.com/repos/apparatus/fuge/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/apparatus/fuge/labels{/name}","releases_url":"https://api.github.com/repos/apparatus/fuge/releases{/id}","deployments_url":"https://api.github.com/repos/apparatus/fuge/deployments","created_at":"2015-10-09T08:55:14Z","updated_at":"2016-03-22T19:42:36Z","pushed_at":"2016-03-23T23:27:35Z","git_url":"git://github.com/apparatus/fuge.git","ssh_url":"git@github.com:apparatus/fuge.git","clone_url":"https://github.com/apparatus/fuge.git","svn_url":"https://github.com/apparatus/fuge","homepage":null,"size":941,"stargazers_count":130,"watchers_count":130,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":17,"mirror_url":null,"open_issues_count":29,"forks":17,"open_issues":29,"watchers":130,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/apparatus/fuge/pulls/64"},"html":{"href":"https://github.com/apparatus/fuge/pull/64"},"issue":{"href":"https://api.github.com/repos/apparatus/fuge/issues/64"},"comments":{"href":"https://api.github.com/repos/apparatus/fuge/issues/64/comments"},"review_comments":{"href":"https://api.github.com/repos/apparatus/fuge/pulls/64/comments"},"review_comment":{"href":"https://api.github.com/repos/apparatus/fuge/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apparatus/fuge/pulls/64/commits"},"statuses":{"href":"https://api.github.com/repos/apparatus/fuge/statuses/bc4a9baead4c59cd4c0b6ab680134d2564cec368"}}}}