mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-13 11:38:36 -05:00
Merge from vscode cfc1ab4c5f816765b91fb7ead3c3427a7c8581a3
This commit is contained in:
@@ -124,10 +124,7 @@ export class EnvironmentService implements IEnvironmentService {
|
||||
get userDataSyncLogResource(): URI { return URI.file(path.join(this.logsPath, 'userDataSync.log')); }
|
||||
|
||||
@memoize
|
||||
get machineSettingsHome(): URI { return URI.file(path.join(this.userDataPath, 'Machine')); }
|
||||
|
||||
@memoize
|
||||
get machineSettingsResource(): URI { return resources.joinPath(this.machineSettingsHome, 'settings.json'); }
|
||||
get machineSettingsResource(): URI { return resources.joinPath(URI.file(path.join(this.userDataPath, 'Machine')), 'settings.json'); }
|
||||
|
||||
@memoize
|
||||
get globalStorageHome(): string { return path.join(this.appSettingsHome.fsPath, 'globalStorage'); }
|
||||
@@ -248,10 +245,6 @@ export class EnvironmentService implements IEnvironmentService {
|
||||
get verbose(): boolean { return !!this._args.verbose; }
|
||||
get log(): string | undefined { return this._args.log; }
|
||||
|
||||
get wait(): boolean { return !!this._args.wait; }
|
||||
|
||||
get status(): boolean { return !!this._args.status; }
|
||||
|
||||
@memoize
|
||||
get mainIPCHandle(): string { return getIPCHandle(this.userDataPath, 'main'); }
|
||||
|
||||
|
||||
@@ -39,18 +39,20 @@ export function getStdinFilePath(): string {
|
||||
return paths.join(os.tmpdir(), `code-stdin-${Math.random().toString(36).replace(/[^a-z]+/g, '').substr(0, 3)}.txt`);
|
||||
}
|
||||
|
||||
export function readFromStdin(targetPath: string, verbose: boolean): Promise<any> {
|
||||
export async function readFromStdin(targetPath: string, verbose: boolean): Promise<void> {
|
||||
|
||||
// open tmp file for writing
|
||||
const stdinFileStream = fs.createWriteStream(targetPath);
|
||||
// Pipe into tmp file using terminals encoding
|
||||
return resolveTerminalEncoding(verbose).then(async encoding => {
|
||||
|
||||
const iconv = await import('iconv-lite');
|
||||
if (!iconv.encodingExists(encoding)) {
|
||||
console.log(`Unsupported terminal encoding: ${encoding}, falling back to UTF-8.`);
|
||||
encoding = 'utf8';
|
||||
}
|
||||
const converterStream = iconv.decodeStream(encoding);
|
||||
process.stdin.pipe(converterStream).pipe(stdinFileStream);
|
||||
});
|
||||
let encoding = await resolveTerminalEncoding(verbose);
|
||||
|
||||
const iconv = await import('iconv-lite');
|
||||
if (!iconv.encodingExists(encoding)) {
|
||||
console.log(`Unsupported terminal encoding: ${encoding}, falling back to UTF-8.`);
|
||||
encoding = 'utf8';
|
||||
}
|
||||
|
||||
// Pipe into tmp file using terminals encoding
|
||||
const converterStream = iconv.decodeStream(encoding);
|
||||
process.stdin.pipe(converterStream).pipe(stdinFileStream);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user