mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-22 17:48:56 +01:00
Merge pull request #124346 from microsoft/ben/pfs-promises
fs - favor non promise based methods (fix #124176)
This commit is contained in:
@@ -8,8 +8,7 @@ import type * as vscode from 'vscode';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { join } from 'vs/base/common/path';
|
||||
import { toLocalISOString } from 'vs/base/common/date';
|
||||
import { SymlinkSupport } from 'vs/base/node/pfs';
|
||||
import { promises } from 'fs';
|
||||
import { Promises, SymlinkSupport } from 'vs/base/node/pfs';
|
||||
import { AbstractExtHostOutputChannel, ExtHostPushOutputChannel, ExtHostOutputService, LazyOutputChannel } from 'vs/workbench/api/common/extHostOutput';
|
||||
import { IExtHostInitDataService } from 'vs/workbench/api/common/extHostInitDataService';
|
||||
import { IExtHostRpcService } from 'vs/workbench/api/common/extHostRpcService';
|
||||
@@ -111,7 +110,7 @@ export class ExtHostOutputService2 extends ExtHostOutputService {
|
||||
const outputDirPath = join(this._logsLocation.fsPath, `output_logging_${toLocalISOString(new Date()).replace(/-|:|\.\d+Z$/g, '')}`);
|
||||
const exists = await SymlinkSupport.existsDirectory(outputDirPath);
|
||||
if (!exists) {
|
||||
await promises.mkdir(outputDirPath, { recursive: true });
|
||||
await Promises.mkdir(outputDirPath, { recursive: true });
|
||||
}
|
||||
const fileName = `${this._namePool++}-${name.replace(/[\\/:\*\?"<>\|]/g, '')}`;
|
||||
const file = URI.file(join(outputDirPath, `${fileName}.log`));
|
||||
|
||||
@@ -11,7 +11,6 @@ import { IExtHostInitDataService } from 'vs/workbench/api/common/extHostInitData
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { exec } from 'child_process';
|
||||
import * as resources from 'vs/base/common/resources';
|
||||
import * as fs from 'fs';
|
||||
import * as pfs from 'vs/base/node/pfs';
|
||||
import * as types from 'vs/workbench/api/common/extHostTypes';
|
||||
import { isLinux } from 'vs/base/common/platform';
|
||||
@@ -365,8 +364,8 @@ export class ExtHostTunnelService extends Disposable implements IExtHostTunnelSe
|
||||
let tcp: string = '';
|
||||
let tcp6: string = '';
|
||||
try {
|
||||
tcp = await fs.promises.readFile('/proc/net/tcp', 'utf8');
|
||||
tcp6 = await fs.promises.readFile('/proc/net/tcp6', 'utf8');
|
||||
tcp = await pfs.Promises.readFile('/proc/net/tcp', 'utf8');
|
||||
tcp6 = await pfs.Promises.readFile('/proc/net/tcp6', 'utf8');
|
||||
} catch (e) {
|
||||
// File reading error. No additional handling needed.
|
||||
}
|
||||
@@ -387,10 +386,10 @@ export class ExtHostTunnelService extends Disposable implements IExtHostTunnelSe
|
||||
try {
|
||||
const pid: number = Number(childName);
|
||||
const childUri = resources.joinPath(URI.file('/proc'), childName);
|
||||
const childStat = await fs.promises.stat(childUri.fsPath);
|
||||
const childStat = await pfs.Promises.stat(childUri.fsPath);
|
||||
if (childStat.isDirectory() && !isNaN(pid)) {
|
||||
const cwd = await fs.promises.readlink(resources.joinPath(childUri, 'cwd').fsPath);
|
||||
const cmd = await fs.promises.readFile(resources.joinPath(childUri, 'cmdline').fsPath, 'utf8');
|
||||
const cwd = await pfs.Promises.readlink(resources.joinPath(childUri, 'cwd').fsPath);
|
||||
const cmd = await pfs.Promises.readFile(resources.joinPath(childUri, 'cmdline').fsPath, 'utf8');
|
||||
processes.push({ pid, cwd, cmd });
|
||||
}
|
||||
} catch (e) {
|
||||
|
||||
Reference in New Issue
Block a user