SShortSingh.
Back to feed

Why an AI agent's shell command showed no output: stdout buffering when not a terminal

0
·4 views

A developer found that Claude Code's Bash tool reported a script as still running after two minutes, with its output file empty, even though the script printed a line every second when run manually. The article attributes this to C and Python libraries switching stdout to block buffering when it is not connected to a terminal, which an agent's shell capture is not. Output therefore sits in memory until the buffer fills, the program flushes, or it exits, as documented in glibc and Python's sys docs. The author notes that Node handles pipe writes differently, with its own risk of losing output on process.exit(). Suggested fixes include setting PYTHONUNBUFFERED for Python children, using stdbuf for C programs on Linux, or adding PTY support to the tool.

Read the full story at DEV Community

This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)

Log in to join the discussion and vote.

Log in

Related stories

0
ProgrammingDEV Community ·

Marketing Agencies Face a 2030 Shift as AI Commoditizes Execution Work

Agencies have long billed clients by the hour for creative and analytical output, but AI tools now produce much of that work in seconds, undermining the traditional model. Producing generic AI content in larger volumes would only intensify price competition, and many brands are moving routine production in-house. The article argues that lasting value lies in defining the real business problem, setting the creative standard, verifying outputs, and building client trust. It predicts the industry will split between large automated platforms and small, high-caliber advisory teams, leaving little room for the middle.

0
ProgrammingDEV Community ·

COBOL Phoenix Translates Legacy COBOL to Python and Verifies Behavior Against GnuCOBOL

A developer built COBOL Phoenix, an open-source tool that converts COBOL programs into Python while checking that the output matches the original. The project includes a custom COBOL front end that flags unsupported constructs rather than silently dropping them, and a runtime that reproduces COBOL's decimal handling, rounding, and sign behavior. Verification compares results against GnuCOBOL using generated test inputs and mutation analysis to confirm the test suite catches injected faults. Reported results include 127 of 127 sample cases matching GnuCOBOL, 180 of 180 on an independent insurance underwriting program, and 20 programs parsed without errors. The project was created for the Kiroween 2026 hackathon and is available under the Apache-2.0 license.

0
ProgrammingDEV Community ·

VigilShield: $19 Windows tool blocks connections to known attacker servers

A school teacher from Narowal, Pakistan has built VigilShield, a one-time $19 guard for Windows 10 and 11 that monitors outbound network connections. It checks each connection against threat lists drawn from public feeds such as abuse.ch and FireHOL, and blocks matches through Windows Firewall with an alert. The tool also includes ransomware canary files, alerts for suspicious programs, and USB, startup and hosts-file guards. The developer states it is not an antivirus replacement, cannot predict attacks, and does not stop every attack, and that it runs locally without sending data elsewhere.

0
ProgrammingDEV Community ·

Lambda Powertools TypeScript adds structured logs, custom metrics and traces

Lambda Powertools for TypeScript is an open source AWS toolkit that removes the need to write repetitive observability helpers in every function. The article walks through a small fictional bike rental API built with the Serverless Framework and tested locally with Vitest. It uses three packages, Logger, Metrics and Tracer, plugged into handlers through the Middy middleware engine. The author notes that consistent JSON logs with correlation IDs and custom CloudWatch metrics are the main benefits, while high-cardinality metric dimensions can drive up costs. The guide covers setup, correlation IDs, choosing between dimensions, metadata and X-Ray annotations, and the impact on cold starts and billing.