MCPcopy
hub / github.com/continuedev/continue / getDecodedOutput

Function getDecodedOutput

core/tools/implementations/runTerminalCommand.ts:10–24  ·  view source on GitHub ↗
(data: Buffer)

Source from the content-addressed store, hash-verified

8
9// Automatically decode the buffer according to the platform to avoid garbled Chinese
10function getDecodedOutput(data: Buffer): string {
11 if (process.platform === "win32") {
12 try {
13 let out = iconv.decode(data, "utf-8");
14 if (/�/.test(out)) {
15 out = iconv.decode(data, "gbk");
16 }
17 return out;
18 } catch {
19 return iconv.decode(data, "gbk");
20 }
21 } else {
22 return data.toString();
23 }
24} // Simple helper function to use login shell on Unix/macOS and PowerShell on Windows
25function getShellCommand(command: string): { shell: string; args: string[] } {
26 if (process.platform === "win32") {
27 // Windows: Use PowerShell

Callers 1

runTerminalCommandImplFunction · 0.85

Calls 2

testMethod · 0.80
decodeMethod · 0.65

Tested by

no test coverage detected