{"id":17002100,"url":"https://github.com/sagiegurari/c_scriptexec","last_synced_at":"2025-04-12T06:21:34.221Z","repository":{"id":139264123,"uuid":"268166411","full_name":"sagiegurari/c_scriptexec","owner":"sagiegurari","description":"Invoke complex multi command scripts with a single C api call.","archived":false,"fork":false,"pushed_at":"2023-09-27T07:12:12.000Z","size":46,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-26T01:41:31.476Z","etag":null,"topics":["c","c-lib","c-library","script"],"latest_commit_sha":null,"homepage":null,"language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sagiegurari.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2020-05-30T21:59:48.000Z","updated_at":"2022-01-29T09:29:23.000Z","dependencies_parsed_at":null,"dependency_job_id":"077444e9-ef16-4ec2-a382-b0da63ee1aed","html_url":"https://github.com/sagiegurari/c_scriptexec","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sagiegurari%2Fc_scriptexec","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sagiegurari%2Fc_scriptexec/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sagiegurari%2Fc_scriptexec/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sagiegurari%2Fc_scriptexec/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sagiegurari","download_url":"https://codeload.github.com/sagiegurari/c_scriptexec/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248525776,"owners_count":21118750,"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":["c","c-lib","c-library","script"],"created_at":"2024-10-14T04:27:03.726Z","updated_at":"2025-04-12T06:21:34.200Z","avatar_url":"https://github.com/sagiegurari.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# scriptexec\n\n[![CI](https://github.com/sagiegurari/c_scriptexec/workflows/CI/badge.svg?branch=master)](https://github.com/sagiegurari/c_scriptexec/actions)\n[![Release](https://img.shields.io/github/v/release/sagiegurari/c_scriptexec)](https://github.com/sagiegurari/c_scriptexec/releases)\n[![license](https://img.shields.io/github/license/sagiegurari/c_scriptexec)](https://github.com/sagiegurari/c_scriptexec/blob/master/LICENSE)\n\n\u003e Invoke complex multi command scripts with a single C api call.\n\n* [Overview](#overview)\n* [Usage](#usage)\n* [Contributing](.github/CONTRIBUTING.md)\n* [Release History](CHANGELOG.md)\n* [License](#license)\n\n\u003ca name=\"overview\"\u003e\u003c/a\u003e\n## Overview\nThis library enables to invoke complex multi command scripts with a single C api call and get the script status code and out/err.\n\n\u003ca name=\"usage\"\u003e\u003c/a\u003e\n## Usage\n\n\u003c!-- example source start --\u003e\n```c\n#include \"scriptexec.h\"\n#include \u003cstdio.h\u003e\n#include \u003cstdlib.h\u003e\n\n\nint main()\n{\n  // invoke the script with default options\n  struct ScriptExecResult result = scriptexec_run(\"echo 1\\necho 2\\necho 3\\necho 4\");\n\n  printf(\"Code: %d\\nOutput:\\n%s\\nError:\\n%s\\n\", result.code, result.out, result.err);\n\n  // invoke the script with custom options\n  struct ScriptExecOptions options = scriptexec_create_options();\n  options.runner            = \"bash\";     // default is 'sh'\n  options.working_directory = \"./target\"; // default to current working directory\n  options.exit_on_error     = true;       // default true, will break script execution on any error\n  options.print_commands    = true;       // default false, if true will print every command before invocation\n\n  result = scriptexec_run_with_options(\"echo 1\\necho 2\\necho 3\\necho 4\", options);\n  printf(\"Code: %d\\nOutput:\\n%s\\nError:\\n%s\\n\", result.code, result.out, result.err);\n\n  free(result.out);\n  free(result.err);\n}\n```\n\u003c!-- example source end --\u003e\n\n## Contributing\nSee [contributing guide](.github/CONTRIBUTING.md)\n\n\u003ca name=\"history\"\u003e\u003c/a\u003e\n## Release History\n\nSee [Changelog](CHANGELOG.md)\n\n\u003ca name=\"license\"\u003e\u003c/a\u003e\n## License\nDeveloped by Sagie Gur-Ari and licensed under the Apache 2 open source license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsagiegurari%2Fc_scriptexec","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsagiegurari%2Fc_scriptexec","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsagiegurari%2Fc_scriptexec/lists"}