Skip to content

Commit

Permalink
Fail to read from stdin (#229962) (#229967)
Browse files Browse the repository at this point in the history
  • Loading branch information
bpasero authored Sep 27, 2024
1 parent 8af8a57 commit a1afeb6
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/vs/platform/environment/node/stdin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ export function getStdinFilePath(): string {
export async function readFromStdin(targetPath: string, verbose: boolean, onEnd?: Function): Promise<void> {

let [encoding, iconv] = await Promise.all([
resolveTerminalEncoding(verbose), // respect terminal encoding when piping into file
import('@vscode/iconv-lite-umd'), // lazy load encoding module for usage
fs.promises.appendFile(targetPath, '') // make sure file exists right away (https://github.com/microsoft/vscode/issues/155341)
resolveTerminalEncoding(verbose), // respect terminal encoding when piping into file
import('@vscode/iconv-lite-umd'), // lazy load encoding module for usage
fs.promises.appendFile(targetPath, '') // make sure file exists right away (https://github.com/microsoft/vscode/issues/155341)
]);

if (!iconv.encodingExists(encoding)) {
if (!iconv.default.encodingExists(encoding)) {
console.log(`Unsupported terminal encoding: ${encoding}, falling back to UTF-8.`);
encoding = 'utf8';
}
Expand All @@ -59,7 +59,7 @@ export async function readFromStdin(targetPath: string, verbose: boolean, onEnd?

const appendFileQueue = new Queue();

const decoder = iconv.getDecoder(encoding);
const decoder = iconv.default.getDecoder(encoding);

process.stdin.on('data', chunk => {
const chunkStr = decoder.write(chunk);
Expand Down

0 comments on commit a1afeb6

Please sign in to comment.