{"id":20428887,"url":"https://github.com/mhashim6/system-command-executor","last_synced_at":"2026-03-09T17:45:01.245Z","repository":{"id":50666852,"uuid":"77171846","full_name":"mhashim6/System-Command-Executor","owner":"mhashim6","description":"A library to make the process of executing system commands through java a simple task.","archived":false,"fork":false,"pushed_at":"2022-07-31T12:50:48.000Z","size":58,"stargazers_count":24,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-16T11:46:06.395Z","etag":null,"topics":["beginner-friendly","command-line-tools","java","library","object-oriented","oop"],"latest_commit_sha":null,"homepage":"","language":"Java","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/mhashim6.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":["mhashim6"],"custom":["https://www.buymeacoffee.com/mhashim6"]}},"created_at":"2016-12-22T19:52:30.000Z","updated_at":"2025-02-09T19:07:27.000Z","dependencies_parsed_at":"2022-08-25T23:12:24.373Z","dependency_job_id":null,"html_url":"https://github.com/mhashim6/System-Command-Executor","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/mhashim6/System-Command-Executor","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mhashim6%2FSystem-Command-Executor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mhashim6%2FSystem-Command-Executor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mhashim6%2FSystem-Command-Executor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mhashim6%2FSystem-Command-Executor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mhashim6","download_url":"https://codeload.github.com/mhashim6/System-Command-Executor/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mhashim6%2FSystem-Command-Executor/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30305297,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-09T17:35:44.120Z","status":"ssl_error","status_checked_at":"2026-03-09T17:35:43.707Z","response_time":61,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["beginner-friendly","command-line-tools","java","library","object-oriented","oop"],"created_at":"2024-11-15T07:29:17.454Z","updated_at":"2026-03-09T17:45:01.214Z","avatar_url":"https://github.com/mhashim6.png","language":"Java","readme":"Simple Library to make the process of executing system commands through java a simple task.\nThe library is thread-safe, can be used to execute multiple commands asynchronously.\n\n------\n**How to**\n\nIf you want to execute a command, and redirect the output to the `console`:\n\n    try {\n    CommandExecutor.execute(\"ping google.com\");\n    }\n    catch (IOException e) {\n    e.printStackTrace();\n    }\n\n------\nHowever, this library gives you more control over the commands being executed; \n\n - You can use the `CommandBuilder` as *wrapper* for the parts that form the command line you\n   want to execute; such as arguments\n   (`CommandBuilder#withArgs`) and\n   options(`CommandBuilder#withOptions`).\n   \n - You can *redirect* the `standard` and `error` outputs to any object You want, just *implement* the `Appender` interface.\n\n - You can *retrieve* the `exit code` of the process, or *abort* the process,\n   by simply using the `ProcessMonitor` and `ExecutionReport` objects.\n\n\n------\nAn advanced example:\n\n    Command cmd = new CommandBuilder().forCommandLine(\"ping\").withArgs(\"google.com\").build();\n    ExecutionOutputPrinter eop = new ExecutionOutputPrinter(new Appender() {\n    \n    @Override\n    public void appendStdText(String text) {\n    // your code to show std output lines.\n    }\n    \n    @Override\n    public void appendErrText(String text) {\n    // your code to show error lines.\n    }\n    });\n    \n    try {\n    ProcessMonitor pMonitor = CommandExecutor.execute(cmd, null, eop); //execute the command, redirect the output to eop.\n    ExecutionReport report = pMonitor.getExecutionReport(); //blocks until the process finishes or gets aborted.\n    \n    String commandLine = cmd.string();\n    int exitCode = report.exitValue();\n    \n    System.out.printf(\"command line: %s\\nexecution finished with exit code: %d\\n\\n\", commandLine, exitCode);\n    }\n    catch (UnrecognisedCmdException e) {\n    System.err.println(e);\n    }\n\nto abort a running process (command), you can use the `ProcessMonitor` instance that you obtained previously:\n\n    pMonitor.abort();\n\n\n----------\n","funding_links":["https://github.com/sponsors/mhashim6","https://www.buymeacoffee.com/mhashim6"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmhashim6%2Fsystem-command-executor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmhashim6%2Fsystem-command-executor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmhashim6%2Fsystem-command-executor/lists"}