Skip to content

Scanner fails with '/dev/tty: Device not configured' when run non-interactively #76

@mrtwebdesign

Description

@mrtwebdesign

Summary

When running check-performance.sh from a non-interactive context (e.g., AI assistant, CI/CD, subprocess), the scanner fails with multiple /dev/tty: Device not configured errors and does not generate HTML reports or log files.

Steps to Reproduce

  1. Run the scanner from a non-interactive shell (no TTY attached):
./dist/bin/check-performance.sh --paths /path/to/theme --format json
  1. Observe errors at the end of execution:
/Users/.../check-performance.sh: line 5537: /dev/tty: Device not configured
/Users/.../check-performance.sh: line 5541: /dev/tty: Device not configured
/Users/.../check-performance.sh: line 5605: /dev/tty: Device not configured
/Users/.../check-performance.sh: line 5606: /dev/tty: Device not configured

Expected Behavior

Scanner should detect non-interactive mode and either:

  • Skip interactive prompts entirely
  • Use sensible defaults when TTY is unavailable
  • Provide a --non-interactive or --batch flag

Actual Behavior

  • JSON output is printed to stdout (works)
  • HTML report is NOT generated
  • Log file may not be written
  • Exit code is 1 (unclear if from findings or TTY errors)

Environment

  • macOS Darwin 24.6.0
  • Scanner version: 1.2.4
  • Context: Running from Claude Code (AI assistant without TTY)

Suggested Fix

Check for TTY availability before prompting:

if [ -t 0 ]; then
    # Interactive prompts OK
else
    # Use defaults or skip
fi

Impact

Blocks AI-assisted workflows and CI/CD integration when HTML reports are needed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions