diff options
| author | JP Appel <jeanpierre.appel01@gmail.com> | 2024-07-22 17:14:53 -0400 |
|---|---|---|
| committer | JP Appel <jeanpierre.appel01@gmail.com> | 2024-07-22 17:14:53 -0400 |
| commit | d6d53541c974708529789bdbd982fd13c214ed51 (patch) | |
| tree | 1ea0401322cc4653519087d2c0ab83427d468f67 /eztester.c | |
| parent | 8cc3b79c41d1922c572608f000a48c068ae4c212 (diff) | |
FEAT: add function to run shell commands
Diffstat (limited to 'eztester.c')
| -rw-r--r-- | eztester.c | 23 |
1 files changed, 23 insertions, 0 deletions
@@ -166,6 +166,7 @@ void eztester_run(eztester_list *test_list, eztester_behavior behavior) { _ez_premature_exit("Warning occured, Exitting", pid, i + 1, pass_count, length); } + pass_count++; break; case TEST_FAIL: @@ -198,6 +199,28 @@ void eztester_run(eztester_list *test_list, eztester_behavior behavior) { } } +int eztester_shell(const char *command) { + int result; + if (command == NULL) { + eztester_log("Recieved NULL as command, checking for shell availability"); + result = !system(command); + eztester_log("Shell %s available", (result) ? "is not" : "is"); + return result; + } + + eztester_log("Executing %s", command); + result = system(command); + if(result == -1){ + eztester_log("Error with child process"); + perror(command); + } + else { + eztester_log("Process exited with a status of %d", result); + } + + return result; +} + void eztester_log(const char *restrict format, ...) { va_list args; va_start(args, format); |
