using Php;

namespace PhpNative {
    public string shell_exec (string command) {
        string? standard_output = null;
        string? standard_error = null;
        int exit_status = 0;
        try {
            Process.spawn_command_line_sync (command, out standard_output, out standard_error, out exit_status);
        } catch (Error e) {
            return "";
        }

        if (standard_output == null) {
            return "";
        }

        return standard_output;
    }
}
