{"id":25005655,"url":"https://github.com/brandonxlf/rust-system","last_synced_at":"2025-07-24T13:02:54.971Z","repository":{"id":228262765,"uuid":"773514671","full_name":"BrandonXLF/rust-system","owner":"BrandonXLF","description":"Crate to easily run system/shell commands across different platforms, similar to the C system command.","archived":false,"fork":false,"pushed_at":"2024-03-18T18:49:40.000Z","size":29,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-02T06:07:40.802Z","etag":null,"topics":["rust","shell-commands"],"latest_commit_sha":null,"homepage":"https://crates.io/crates/system","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/BrandonXLF.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-03-17T21:28:36.000Z","updated_at":"2024-07-30T16:14:52.000Z","dependencies_parsed_at":"2024-03-17T23:21:27.798Z","dependency_job_id":"0e8c750f-7019-445b-8f22-79403c315189","html_url":"https://github.com/BrandonXLF/rust-system","commit_stats":null,"previous_names":["brandonxlf/rust-system"],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/BrandonXLF/rust-system","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BrandonXLF%2Frust-system","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BrandonXLF%2Frust-system/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BrandonXLF%2Frust-system/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BrandonXLF%2Frust-system/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BrandonXLF","download_url":"https://codeload.github.com/BrandonXLF/rust-system/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BrandonXLF%2Frust-system/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261206088,"owners_count":23124834,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["rust","shell-commands"],"created_at":"2025-02-05T00:47:07.828Z","updated_at":"2025-06-21T23:03:45.270Z","avatar_url":"https://github.com/BrandonXLF.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# system\n\nCross-platform crate to easily run shell commands, similar to the C `system` function.\n\n## Usage\n\n### `system` and `system_output`\n\nFor simple use cases where you just need the result of a system command, the `system` and `system_output` functions can be used.\n\n`system` inherits the stdout, stderr, and stdin from the parent process whereas `system_output` captures stdout and stderr and does not inherit an stdin.\n\nAn example of using `system`,\n\n```rust\nuse system::system;\n\nfn main() {\n    // Prints \"Hello, world!\"\n    system(\"echo Hello, world!\").expect(\"Failed to run command.\");\n}\n```\n\nAn example of using `system_output`,\n\n```rust\nuse system::system_output;\n\nfn main() {\n    let out = system_output(\"echo Hello, world!\").expect(\"Failed to run command.\");\n    let stdout = String::from_utf8_lossy(\u0026out.stdout);\n\n    #[cfg(target_os = \"windows\")]\n    assert_eq!(stdout, \"Hello, world!\\r\\n\");\n\n    #[cfg(not(target_os = \"windows\"))]\n    assert_eq!(stdout, \"Hello, world!\\n\");\n}\n```\n\n### `std::process::Command::system`\n\nFor more complex uses cases where the underlying `Command` has to be modified before running the command, the `system::System` trait is implemented for `Command`.\n\nThe trait adds the function `Command::system` to create `Command`s that execute shell commands.\n\nFor example,\n\n```rust\nuse std::process::Command;\n\nuse system::System;\n\nfn test() {\n    let out = Command::system(\"echo Hello, world!\")\n        .output()\n        .expect(\"Failed to run command.\");\n    let stdout = String::from_utf8_lossy(\u0026out.stdout);\n\n    #[cfg(target_os = \"windows\")]\n    assert_eq!(stdout, \"Hello, world!\\r\\n\");\n\n    #[cfg(not(target_os = \"windows\"))]\n    assert_eq!(stdout, \"Hello, world!\\n\");\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrandonxlf%2Frust-system","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbrandonxlf%2Frust-system","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrandonxlf%2Frust-system/lists"}