Menu

Vercel Sandbox commands now support stdin - Vercel
📰

Vercel Sandbox commands now support stdin - Vercel

Vercel News·Kishore Devireddy·about 6 hours ago
#RLaVC4PT
#vercel#stdin#sandbox#await#input
Reading 0:00
15s threshold

Vercel Sandbox now lets you send input to running commands through standard input (stdin). Use it to exchange messages with stdio MCP servers such as agent-browser , or send data to other command-line programs while they run.

In the TypeScript SDK, set stdin: true and detached: true in runCommand() . Use writeStdin() to send input and closeStdin() when you’re done:

import { Sandbox } from '@vercel/sandbox' ;

const sandbox = await Sandbox . create ( ) ;

const cmd = await sandbox . runCommand ( {

cmd : 'cat' ,

stdin : true ,

detached : true ,

} ) ;

await cmd . writeStdin ( 'hello' ) ;

await cmd . closeStdin ( ) ;

const result = await cmd . wait ( ) ;

console . log ( await result . stdout ( ) ) ; // "hello"

Send input to a running command and read its output with the Sandbox TypeScript SDK.

You can also set stdin to a Node.js readable stream, such as process.stdin .…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.