Skip to main content
Glama
CommandExecutor.test.ts1.01 kB
import CommandExecutor from '../src/CommandExecutor.js'; import TtyOutputReader from '../src/TtyOutputReader.js'; async function testExecuteCommand() { const executor = new CommandExecutor(); // Combine all arguments after the script name into a single command const command = process.argv.slice(2).join(' ') || 'date'; try { const beforeCommandBuffer = await TtyOutputReader.retrieveBuffer(); const beforeCommandBufferLines = beforeCommandBuffer.split("\n").length; await executor.executeCommand(command); const afterCommandBuffer = await TtyOutputReader.retrieveBuffer(); const afterCommandBufferLines = afterCommandBuffer.split("\n").length; const outputLines = afterCommandBufferLines - beforeCommandBufferLines const buffer = await TtyOutputReader.call(outputLines) console.log(buffer); console.log(`Lines: ${outputLines}`); } catch (error) { console.error('Error executing command:', (error as Error).message); } } testExecuteCommand();

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/lite/iterm-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server