Skip to content

[Bug]: gog CLI produces no stdout in non-interactive environments #18506

@andrianm28

Description

@andrianm28

Summary

gog CLI] No output when executed in non-interactive environments

The gog CLI tool (Google Workspace CLI) works correctly in interactive terminals but produces no stdout output when executed in non-interactive environments, even though commands exit with code 0 (success). This makes the tool unusable for automation, CI/CD pipelines, and agent-based workflows.

    **Key Points:**
    - Commands execute successfully (exit code 0)
    - No stdout, stderr, or output to files
    - Issue occurs in all non-interactive contexts
    - Interactive mode works perfectly

Steps to reproduce

  1. Setup authentication:
    bash export GOG_KEYRING_PASSWORD="your-passphrase" export GOG_ACCOUNT="[email protected]"

     2. **Run basic version check:**
        ```bash
        gog --version
        ```
        **Expected:** Version information displayed
        **Actual:** No output (empty stdout)
     
     3. **Test Gmail search:**
        ```bash
        gog gmail search 'newer_than:1d' --max 5
        ```
        **Expected:** List of recent emails
        **Actual:** No output
     
     4. **Verify exit code:**
        ```bash
        gog --version
        echo $?
        ```
        **Result:** 0 (success, but no output)
     
     5. **Test output redirection:**
        ```bash
        gog --version > /tmp/version.txt
        cat /tmp/version.txt
        ```
        **Result:** File is 0 bytes
    

Expected behavior

When running gog --version in any environment (interactive or non-interactive), it should display:
gog version 1.2.3

    When running `gog gmail search 'newer_than:1d' --max 1`, it should display:
    ```
    ID                DATE              FROM              SUBJECT  LABELS  THREAD
    19c67a4eb49b4251  2026-02-17 01:09  [email protected]  Test     INBOX   -
    ```
    
    Output should be written to stdout and captured by:
    - File redirection (`>`)
    - Pipe operations (`|`)
    - Subprocess capture
    - Automation tools

Actual behavior

...Actual Behavior:
- Command executes successfully (exit code: 0)
- Stdout: Completely empty (zero bytes)
- Stderr: Completely empty

  • File redirection: Creates 0-byte files
    - Subprocess capture: Returns empty strings
    - No error messages displayed

      **Specific Examples:**
      ```bash
      $ gog --version
      $ echo $?
      0
      
      $ gog gmail search 'newer_than:1d' --max 1
      $ echo $?
      0
      
      $ gog --version > /tmp/out.txt
      $ wc -c /tmp/out.txt
      0 /tmp/out.txt...
    

Interactive Environment (Works):
- Terminal: GNOME Terminal 3.44.0
- Shell: bash 5.1.16
- TTY: /dev/pts/0

    **Non-Interactive Environments (Fails):**
    - OpenClaw exec tool
    - Python subprocess: `subprocess.run(['gog', '--version'], capture_output=True)`
    - Bash script: `#!/bin/bash\ngog --version`
    - CI/CD pipeline: GitHub Actions, Jenkins
    - File redirection: `gog --version > file.txt`
    
    **System Information:**
    - OS: Linux 6.6.117-45.1.oc9.x86_64 (x64)
    - gog CLI: Latest from steipete/tap/gogcli
    - Python: 3.11.7
    - Node: v24.13.1
    - OpenClaw: 2026.2.15 (3fe22ea)

OpenClaw version

2026.2.15

Operating system

Linux 6.6.117-45.1.oc9.x86_64 (x64)

Install method

npm global

Logs, screenshots, and evidence

**Interactive Terminal (Working):**
        
        $ gog --version
        gog version 1.2.3
        
        $ gog gmail search 'newer_than:1d' --max 1
        ID                DATE              FROM              SUBJECT  LABELS  THREAD
        19c67a4eb49b4251  2026-02-17 01:09  [email protected]  Test     INBOX   -
        
        
        **Non-Interactive (Failing):**
        
        $ gog --version
        $ echo $?
        0
        
        $ gog --version > /tmp/out.txt
        $ cat /tmp/out.txt
        (no output)
        
        $ python3 -c "import subprocess; r = subprocess.run(['gog', '--version'], capture_output=True, text=True); print(f'exit:{r.returncode}, stdout:\"{r.stdout}\", stderr:\"{r.stderr}\"')"
        exit:0, stdout:"", stderr:""

Impact and severity

This issue makes gog completely unusable for:
- Email automation workflows: Cannot read or process emails automatically
- CI/CD pipelines: Cannot send notifications or check for alerts
- Agent-based task automation: OpenClaw and similar tools cannot use gog
- Scheduled email processing: Cron jobs cannot process emails
- Integration with other tools: Cannot pipe output to other commands

    **Business Impact:**
    - Forces migration to direct Google API usage
    - Increases development time and complexity
    - Breaks existing automation that relied on gog CLI
    - Blocks adoption of gog in automation platforms
    
    **Workaround Attempted:**
    - Direct Gmail API via Python (works, but requires rewriting automation logic)
    - This is the only viable alternative currently

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions