{"action":"created","comment":{"url":"https://api.github.com/repos/rust-lang/cargo/pulls/comments/22429844","id":22429844,"diff_hunk":"@@ -59,8 +61,8 @@ impl Compilation {\n     ///\n     /// The package argument is also used to configure environment variables as\n     /// well as the working directory of the child process.\n-    pub fn process<T: ToCStr>(&self, cmd: T, pkg: &Package)\n-                              -> CargoResult<util::ProcessBuilder> {\n+    pub fn process(&self, cmd: CommandType, pkg: &Package)\n+                   -> CargoResult<CommandPrototype> {","path":"src/cargo/ops/cargo_rustc/compilation.rs","position":16,"original_position":16,"commit_id":"baa76860b7d62db3ecf1bfd1c67bc74f592ff8bc","original_commit_id":"baa76860b7d62db3ecf1bfd1c67bc74f592ff8bc","user":{"login":"alexcrichton","id":64996,"avatar_url":"https://avatars.githubusercontent.com/u/64996?v=3","gravatar_id":"","url":"https://api.github.com/users/alexcrichton","html_url":"https://github.com/alexcrichton","followers_url":"https://api.github.com/users/alexcrichton/followers","following_url":"https://api.github.com/users/alexcrichton/following{/other_user}","gists_url":"https://api.github.com/users/alexcrichton/gists{/gist_id}","starred_url":"https://api.github.com/users/alexcrichton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexcrichton/subscriptions","organizations_url":"https://api.github.com/users/alexcrichton/orgs","repos_url":"https://api.github.com/users/alexcrichton/repos","events_url":"https://api.github.com/users/alexcrichton/events{/privacy}","received_events_url":"https://api.github.com/users/alexcrichton/received_events","type":"User","site_admin":false},"body":"This is already not exactly super-ergonomic to call, could some helper methods for things like `rustc`, `rustdoc`, and `custom` be added to cut down on the boilerplate?","created_at":"2015-01-03T06:01:55Z","updated_at":"2015-01-03T06:01:55Z","html_url":"https://github.com/rust-lang/cargo/pull/1107#discussion_r22429844","pull_request_url":"https://api.github.com/repos/rust-lang/cargo/pulls/1107","_links":{"self":{"href":"https://api.github.com/repos/rust-lang/cargo/pulls/comments/22429844"},"html":{"href":"https://github.com/rust-lang/cargo/pull/1107#discussion_r22429844"},"pull_request":{"href":"https://api.github.com/repos/rust-lang/cargo/pulls/1107"}}},"pull_request":{"url":"https://api.github.com/repos/rust-lang/cargo/pulls/1107","id":26696054,"html_url":"https://github.com/rust-lang/cargo/pull/1107","diff_url":"https://github.com/rust-lang/cargo/pull/1107.diff","patch_url":"https://github.com/rust-lang/cargo/pull/1107.patch","issue_url":"https://api.github.com/repos/rust-lang/cargo/issues/1107","number":1107,"state":"open","locked":false,"title":"Build a CommandPrototype instead of a ProcessBuilder","user":{"login":"tomaka","id":1412254,"avatar_url":"https://avatars.githubusercontent.com/u/1412254?v=3","gravatar_id":"","url":"https://api.github.com/users/tomaka","html_url":"https://github.com/tomaka","followers_url":"https://api.github.com/users/tomaka/followers","following_url":"https://api.github.com/users/tomaka/following{/other_user}","gists_url":"https://api.github.com/users/tomaka/gists{/gist_id}","starred_url":"https://api.github.com/users/tomaka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tomaka/subscriptions","organizations_url":"https://api.github.com/users/tomaka/orgs","repos_url":"https://api.github.com/users/tomaka/repos","events_url":"https://api.github.com/users/tomaka/events{/privacy}","received_events_url":"https://api.github.com/users/tomaka/received_events","type":"User","site_admin":false},"body":"With this change, the various commands in Cargo now build a `CommandPrototype` instead of a `ProcessBuilder`. This `CommandPrototype` is then passed to an object that implements the `CommandsExecution` trait, which executes them.\r\n\r\nIdeally `CommandPrototype` would look like this:\r\n\r\n```rust\r\nenum CommandPrototype {\r\n    Rustc {\r\n        libraries: Vec<String>,\r\n        opt_level: uint,\r\n        input: Path,\r\n        ... etc... (all the options that can be passed to rustc)\r\n    },\r\n    Rustdoc {\r\n        ...  (all the options that can be passed to rustdoc)\r\n    },\r\n    Custom {\r\n        cmd: ...,\r\n        env: ...,\r\n    }\r\n}\r\n```\r\n\r\n...but that's a bit too much work for now (maybe in a follow-up).\r\n\r\n\r\nWhat this enables is using the Cargo library to intercept the build commands and tweak them. I'm planning to write `cargo-emscripten` thanks to this change.\r\n\r\nWith this, one could also imagine embedding rustc and rustdoc directly inside cargo, if that is needed.\r\n","created_at":"2014-12-30T18:04:10Z","updated_at":"2015-01-03T06:01:55Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ba34d460b5ae62f0515799807c8a0161374ec54f","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/rust-lang/cargo/pulls/1107/commits","review_comments_url":"https://api.github.com/repos/rust-lang/cargo/pulls/1107/comments","review_comment_url":"https://api.github.com/repos/rust-lang/cargo/pulls/comments/{number}","comments_url":"https://api.github.com/repos/rust-lang/cargo/issues/1107/comments","statuses_url":"https://api.github.com/repos/rust-lang/cargo/statuses/baa76860b7d62db3ecf1bfd1c67bc74f592ff8bc","head":{"label":"tomaka:extract-commands-system","ref":"extract-commands-system","sha":"baa76860b7d62db3ecf1bfd1c67bc74f592ff8bc","user":{"login":"tomaka","id":1412254,"avatar_url":"https://avatars.githubusercontent.com/u/1412254?v=3","gravatar_id":"","url":"https://api.github.com/users/tomaka","html_url":"https://github.com/tomaka","followers_url":"https://api.github.com/users/tomaka/followers","following_url":"https://api.github.com/users/tomaka/following{/other_user}","gists_url":"https://api.github.com/users/tomaka/gists{/gist_id}","starred_url":"https://api.github.com/users/tomaka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tomaka/subscriptions","organizations_url":"https://api.github.com/users/tomaka/orgs","repos_url":"https://api.github.com/users/tomaka/repos","events_url":"https://api.github.com/users/tomaka/events{/privacy}","received_events_url":"https://api.github.com/users/tomaka/received_events","type":"User","site_admin":false},"repo":{"id":21453403,"name":"cargo","full_name":"tomaka/cargo","owner":{"login":"tomaka","id":1412254,"avatar_url":"https://avatars.githubusercontent.com/u/1412254?v=3","gravatar_id":"","url":"https://api.github.com/users/tomaka","html_url":"https://github.com/tomaka","followers_url":"https://api.github.com/users/tomaka/followers","following_url":"https://api.github.com/users/tomaka/following{/other_user}","gists_url":"https://api.github.com/users/tomaka/gists{/gist_id}","starred_url":"https://api.github.com/users/tomaka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tomaka/subscriptions","organizations_url":"https://api.github.com/users/tomaka/orgs","repos_url":"https://api.github.com/users/tomaka/repos","events_url":"https://api.github.com/users/tomaka/events{/privacy}","received_events_url":"https://api.github.com/users/tomaka/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/tomaka/cargo","description":"The Rust package manager","fork":true,"url":"https://api.github.com/repos/tomaka/cargo","forks_url":"https://api.github.com/repos/tomaka/cargo/forks","keys_url":"https://api.github.com/repos/tomaka/cargo/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tomaka/cargo/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tomaka/cargo/teams","hooks_url":"https://api.github.com/repos/tomaka/cargo/hooks","issue_events_url":"https://api.github.com/repos/tomaka/cargo/issues/events{/number}","events_url":"https://api.github.com/repos/tomaka/cargo/events","assignees_url":"https://api.github.com/repos/tomaka/cargo/assignees{/user}","branches_url":"https://api.github.com/repos/tomaka/cargo/branches{/branch}","tags_url":"https://api.github.com/repos/tomaka/cargo/tags","blobs_url":"https://api.github.com/repos/tomaka/cargo/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tomaka/cargo/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tomaka/cargo/git/refs{/sha}","trees_url":"https://api.github.com/repos/tomaka/cargo/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tomaka/cargo/statuses/{sha}","languages_url":"https://api.github.com/repos/tomaka/cargo/languages","stargazers_url":"https://api.github.com/repos/tomaka/cargo/stargazers","contributors_url":"https://api.github.com/repos/tomaka/cargo/contributors","subscribers_url":"https://api.github.com/repos/tomaka/cargo/subscribers","subscription_url":"https://api.github.com/repos/tomaka/cargo/subscription","commits_url":"https://api.github.com/repos/tomaka/cargo/commits{/sha}","git_commits_url":"https://api.github.com/repos/tomaka/cargo/git/commits{/sha}","comments_url":"https://api.github.com/repos/tomaka/cargo/comments{/number}","issue_comment_url":"https://api.github.com/repos/tomaka/cargo/issues/comments/{number}","contents_url":"https://api.github.com/repos/tomaka/cargo/contents/{+path}","compare_url":"https://api.github.com/repos/tomaka/cargo/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tomaka/cargo/merges","archive_url":"https://api.github.com/repos/tomaka/cargo/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tomaka/cargo/downloads","issues_url":"https://api.github.com/repos/tomaka/cargo/issues{/number}","pulls_url":"https://api.github.com/repos/tomaka/cargo/pulls{/number}","milestones_url":"https://api.github.com/repos/tomaka/cargo/milestones{/number}","notifications_url":"https://api.github.com/repos/tomaka/cargo/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tomaka/cargo/labels{/name}","releases_url":"https://api.github.com/repos/tomaka/cargo/releases{/id}","created_at":"2014-07-03T07:21:22Z","updated_at":"2014-12-30T10:05:24Z","pushed_at":"2014-12-30T17:59:32Z","git_url":"git://github.com/tomaka/cargo.git","ssh_url":"git@github.com:tomaka/cargo.git","clone_url":"https://github.com/tomaka/cargo.git","svn_url":"https://github.com/tomaka/cargo","homepage":"http://crates.io/","size":11082,"stargazers_count":0,"watchers_count":0,"language":"Rust","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"rust-lang:master","ref":"master","sha":"b6f976f14e788c98ec9999f8bd05d784344debea","user":{"login":"rust-lang","id":5430905,"avatar_url":"https://avatars.githubusercontent.com/u/5430905?v=3","gravatar_id":"","url":"https://api.github.com/users/rust-lang","html_url":"https://github.com/rust-lang","followers_url":"https://api.github.com/users/rust-lang/followers","following_url":"https://api.github.com/users/rust-lang/following{/other_user}","gists_url":"https://api.github.com/users/rust-lang/gists{/gist_id}","starred_url":"https://api.github.com/users/rust-lang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rust-lang/subscriptions","organizations_url":"https://api.github.com/users/rust-lang/orgs","repos_url":"https://api.github.com/users/rust-lang/repos","events_url":"https://api.github.com/users/rust-lang/events{/privacy}","received_events_url":"https://api.github.com/users/rust-lang/received_events","type":"Organization","site_admin":false},"repo":{"id":17420913,"name":"cargo","full_name":"rust-lang/cargo","owner":{"login":"rust-lang","id":5430905,"avatar_url":"https://avatars.githubusercontent.com/u/5430905?v=3","gravatar_id":"","url":"https://api.github.com/users/rust-lang","html_url":"https://github.com/rust-lang","followers_url":"https://api.github.com/users/rust-lang/followers","following_url":"https://api.github.com/users/rust-lang/following{/other_user}","gists_url":"https://api.github.com/users/rust-lang/gists{/gist_id}","starred_url":"https://api.github.com/users/rust-lang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rust-lang/subscriptions","organizations_url":"https://api.github.com/users/rust-lang/orgs","repos_url":"https://api.github.com/users/rust-lang/repos","events_url":"https://api.github.com/users/rust-lang/events{/privacy}","received_events_url":"https://api.github.com/users/rust-lang/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/rust-lang/cargo","description":"The Rust package manager","fork":false,"url":"https://api.github.com/repos/rust-lang/cargo","forks_url":"https://api.github.com/repos/rust-lang/cargo/forks","keys_url":"https://api.github.com/repos/rust-lang/cargo/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rust-lang/cargo/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rust-lang/cargo/teams","hooks_url":"https://api.github.com/repos/rust-lang/cargo/hooks","issue_events_url":"https://api.github.com/repos/rust-lang/cargo/issues/events{/number}","events_url":"https://api.github.com/repos/rust-lang/cargo/events","assignees_url":"https://api.github.com/repos/rust-lang/cargo/assignees{/user}","branches_url":"https://api.github.com/repos/rust-lang/cargo/branches{/branch}","tags_url":"https://api.github.com/repos/rust-lang/cargo/tags","blobs_url":"https://api.github.com/repos/rust-lang/cargo/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rust-lang/cargo/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rust-lang/cargo/git/refs{/sha}","trees_url":"https://api.github.com/repos/rust-lang/cargo/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rust-lang/cargo/statuses/{sha}","languages_url":"https://api.github.com/repos/rust-lang/cargo/languages","stargazers_url":"https://api.github.com/repos/rust-lang/cargo/stargazers","contributors_url":"https://api.github.com/repos/rust-lang/cargo/contributors","subscribers_url":"https://api.github.com/repos/rust-lang/cargo/subscribers","subscription_url":"https://api.github.com/repos/rust-lang/cargo/subscription","commits_url":"https://api.github.com/repos/rust-lang/cargo/commits{/sha}","git_commits_url":"https://api.github.com/repos/rust-lang/cargo/git/commits{/sha}","comments_url":"https://api.github.com/repos/rust-lang/cargo/comments{/number}","issue_comment_url":"https://api.github.com/repos/rust-lang/cargo/issues/comments/{number}","contents_url":"https://api.github.com/repos/rust-lang/cargo/contents/{+path}","compare_url":"https://api.github.com/repos/rust-lang/cargo/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rust-lang/cargo/merges","archive_url":"https://api.github.com/repos/rust-lang/cargo/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rust-lang/cargo/downloads","issues_url":"https://api.github.com/repos/rust-lang/cargo/issues{/number}","pulls_url":"https://api.github.com/repos/rust-lang/cargo/pulls{/number}","milestones_url":"https://api.github.com/repos/rust-lang/cargo/milestones{/number}","notifications_url":"https://api.github.com/repos/rust-lang/cargo/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rust-lang/cargo/labels{/name}","releases_url":"https://api.github.com/repos/rust-lang/cargo/releases{/id}","created_at":"2014-03-04T23:20:42Z","updated_at":"2015-01-03T05:42:40Z","pushed_at":"2015-01-03T05:47:26Z","git_url":"git://github.com/rust-lang/cargo.git","ssh_url":"git@github.com:rust-lang/cargo.git","clone_url":"https://github.com/rust-lang/cargo.git","svn_url":"https://github.com/rust-lang/cargo","homepage":"http://crates.io/","size":21789,"stargazers_count":804,"watchers_count":804,"language":"Rust","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":149,"mirror_url":null,"open_issues_count":143,"forks":149,"open_issues":143,"watchers":804,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/rust-lang/cargo/pulls/1107"},"html":{"href":"https://github.com/rust-lang/cargo/pull/1107"},"issue":{"href":"https://api.github.com/repos/rust-lang/cargo/issues/1107"},"comments":{"href":"https://api.github.com/repos/rust-lang/cargo/issues/1107/comments"},"review_comments":{"href":"https://api.github.com/repos/rust-lang/cargo/pulls/1107/comments"},"review_comment":{"href":"https://api.github.com/repos/rust-lang/cargo/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/rust-lang/cargo/pulls/1107/commits"},"statuses":{"href":"https://api.github.com/repos/rust-lang/cargo/statuses/baa76860b7d62db3ecf1bfd1c67bc74f592ff8bc"}}}}