debt - prepare for node 12
This commit is contained in:
parent
2843554849
commit
06aadb28a7
13 changed files with 31 additions and 31 deletions
|
@ -68,7 +68,7 @@ export function renderMarkdown(markdown: IMarkdownString, options: MarkdownRende
|
|||
// signal to code-block render that the
|
||||
// element has been created
|
||||
let signalInnerHTML: () => void;
|
||||
const withInnerHTML = new Promise(c => signalInnerHTML = c);
|
||||
const withInnerHTML = new Promise<void>(c => signalInnerHTML = c);
|
||||
|
||||
const renderer = new marked.Renderer();
|
||||
renderer.image = (href: string, title: string, text: string) => {
|
||||
|
|
|
@ -59,4 +59,4 @@ export class LineDecoder {
|
|||
end(): string | null {
|
||||
return this.remaining;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -365,11 +365,11 @@ export class LineProcess extends AbstractProcess<LineData> {
|
|||
protected handleSpawn(childProcess: cp.ChildProcess, cc: ValueCallback<SuccessData>, pp: ProgressCallback<LineData>, ee: ErrorCallback, sync: boolean): void {
|
||||
const stdoutLineDecoder = new LineDecoder();
|
||||
const stderrLineDecoder = new LineDecoder();
|
||||
childProcess.stdout.on('data', (data: Buffer) => {
|
||||
childProcess.stdout!.on('data', (data: Buffer) => {
|
||||
const lines = stdoutLineDecoder.write(data);
|
||||
lines.forEach(line => pp({ line: line, source: Source.stdout }));
|
||||
});
|
||||
childProcess.stderr.on('data', (data: Buffer) => {
|
||||
childProcess.stderr!.on('data', (data: Buffer) => {
|
||||
const lines = stderrLineDecoder.write(data);
|
||||
lines.forEach(line => pp({ line: line, source: Source.stderr }));
|
||||
});
|
||||
|
|
|
@ -525,7 +525,7 @@ suite('PFS', () => {
|
|||
}
|
||||
|
||||
if (!expectedError || (<any>expectedError).code !== 'EISDIR') {
|
||||
return Promise.reject(new Error('Expected EISDIR error for writing to folder but got: ' + (expectedError ? (<any>expectedError).code : 'no error')));
|
||||
throw new Error('Expected EISDIR error for writing to folder but got: ' + (expectedError ? (<any>expectedError).code : 'no error'));
|
||||
}
|
||||
|
||||
// verify that the stream is still consumable (for https://github.com/Microsoft/vscode/issues/42542)
|
||||
|
@ -551,7 +551,7 @@ suite('PFS', () => {
|
|||
}
|
||||
|
||||
if (!expectedError || expectedError.message !== readError) {
|
||||
return Promise.reject(new Error('Expected error for writing to folder'));
|
||||
throw new Error('Expected error for writing to folder');
|
||||
}
|
||||
|
||||
await pfs.rimraf(parentDir);
|
||||
|
@ -582,7 +582,7 @@ suite('PFS', () => {
|
|||
}
|
||||
|
||||
if (!expectedError || !((<any>expectedError).code !== 'EACCES' || (<any>expectedError).code !== 'EPERM')) {
|
||||
return Promise.reject(new Error('Expected EACCES/EPERM error for writing to folder but got: ' + (expectedError ? (<any>expectedError).code : 'no error')));
|
||||
throw new Error('Expected EACCES/EPERM error for writing to folder but got: ' + (expectedError ? (<any>expectedError).code : 'no error'));
|
||||
}
|
||||
|
||||
await pfs.rimraf(parentDir);
|
||||
|
@ -609,7 +609,7 @@ suite('PFS', () => {
|
|||
}
|
||||
|
||||
if (!expectedError) {
|
||||
return Promise.reject(new Error('Expected error for writing to folder'));
|
||||
throw new Error('Expected error for writing to folder');
|
||||
}
|
||||
|
||||
await pfs.rimraf(parentDir);
|
||||
|
|
|
@ -135,8 +135,8 @@ export async function main(argv: string[]): Promise<any> {
|
|||
env['ELECTRON_ENABLE_LOGGING'] = '1';
|
||||
|
||||
processCallbacks.push(async child => {
|
||||
child.stdout.on('data', (data: Buffer) => console.log(data.toString('utf8').trim()));
|
||||
child.stderr.on('data', (data: Buffer) => console.log(data.toString('utf8').trim()));
|
||||
child.stdout!.on('data', (data: Buffer) => console.log(data.toString('utf8').trim()));
|
||||
child.stderr!.on('data', (data: Buffer) => console.log(data.toString('utf8').trim()));
|
||||
|
||||
await new Promise(c => child.once('exit', () => c()));
|
||||
});
|
||||
|
|
|
@ -98,11 +98,11 @@ export class ExtensionsLifecycle extends Disposable {
|
|||
|
||||
// Catch all output coming from the process
|
||||
type Output = { data: string, format: string[] };
|
||||
extensionUninstallProcess.stdout.setEncoding('utf8');
|
||||
extensionUninstallProcess.stderr.setEncoding('utf8');
|
||||
extensionUninstallProcess.stdout!.setEncoding('utf8');
|
||||
extensionUninstallProcess.stderr!.setEncoding('utf8');
|
||||
|
||||
const onStdout = Event.fromNodeEventEmitter<string>(extensionUninstallProcess.stdout, 'data');
|
||||
const onStderr = Event.fromNodeEventEmitter<string>(extensionUninstallProcess.stderr, 'data');
|
||||
const onStdout = Event.fromNodeEventEmitter<string>(extensionUninstallProcess.stdout!, 'data');
|
||||
const onStderr = Event.fromNodeEventEmitter<string>(extensionUninstallProcess.stderr!, 'data');
|
||||
|
||||
// Log output
|
||||
onStdout(data => this.logService.info(extension.identifier.id, extension.manifest.version, `post-${lifecycleType}`, data));
|
||||
|
|
|
@ -55,7 +55,7 @@ export class OutOfProcessWin32FolderWatcher {
|
|||
const stdoutLineDecoder = new decoder.LineDecoder();
|
||||
|
||||
// Events over stdout
|
||||
this.handle.stdout.on('data', (data: Buffer) => {
|
||||
this.handle.stdout!.on('data', (data: Buffer) => {
|
||||
|
||||
// Collect raw events from output
|
||||
const rawEvents: IDiskFileChange[] = [];
|
||||
|
@ -99,7 +99,7 @@ export class OutOfProcessWin32FolderWatcher {
|
|||
|
||||
// Errors
|
||||
this.handle.on('error', (error: Error) => this.onError(error));
|
||||
this.handle.stderr.on('data', (data: Buffer) => this.onError(data));
|
||||
this.handle.stderr!.on('data', (data: Buffer) => this.onError(data));
|
||||
|
||||
// Exit
|
||||
this.handle.on('exit', (code: number, signal: string) => this.onExit(code, signal));
|
||||
|
|
|
@ -214,14 +214,14 @@ export class ExecutableDebugAdapter extends StreamDebugAdapter {
|
|||
this._onExit.fire(code);
|
||||
});
|
||||
|
||||
this.serverProcess.stdout.on('close', () => {
|
||||
this.serverProcess.stdout!.on('close', () => {
|
||||
this._onError.fire(new Error('read error'));
|
||||
});
|
||||
this.serverProcess.stdout.on('error', error => {
|
||||
this.serverProcess.stdout!.on('error', error => {
|
||||
this._onError.fire(error);
|
||||
});
|
||||
|
||||
this.serverProcess.stdin.on('error', error => {
|
||||
this.serverProcess.stdin!.on('error', error => {
|
||||
this._onError.fire(error);
|
||||
});
|
||||
|
||||
|
@ -231,7 +231,7 @@ export class ExecutableDebugAdapter extends StreamDebugAdapter {
|
|||
// this.serverProcess.stdout.on('data', (data: string) => {
|
||||
// console.log('%c' + sanitize(data), 'background: #ddd; font-style: italic;');
|
||||
// });
|
||||
this.serverProcess.stderr.on('data', (data: string) => {
|
||||
this.serverProcess.stderr!.on('data', (data: string) => {
|
||||
const channel = outputService.getChannel(ExtensionsChannelId);
|
||||
if (channel) {
|
||||
channel.append(sanitize(data));
|
||||
|
@ -240,7 +240,7 @@ export class ExecutableDebugAdapter extends StreamDebugAdapter {
|
|||
}
|
||||
|
||||
// finally connect to the DA
|
||||
this.connect(this.serverProcess.stdout, this.serverProcess.stdin);
|
||||
this.connect(this.serverProcess.stdout!, this.serverProcess.stdin!);
|
||||
|
||||
} catch (err) {
|
||||
this._onError.fire(err);
|
||||
|
|
|
@ -634,7 +634,7 @@ class PreferencesRenderersController extends Disposable {
|
|||
|
||||
if (filterResult) {
|
||||
filterResult.query = filter;
|
||||
filterResult.exactMatch = searchResult && searchResult.exactMatch;
|
||||
filterResult.exactMatch = !!searchResult && searchResult.exactMatch;
|
||||
}
|
||||
|
||||
return filterResult;
|
||||
|
|
|
@ -72,7 +72,7 @@ export class TerminalNativeService implements ITerminalNativeService {
|
|||
const proc = execFile('bash.exe', ['-c', `wslpath ${escapeNonWindowsPath(path)}`], {}, (error, stdout, stderr) => {
|
||||
c(escapeNonWindowsPath(stdout.trim()));
|
||||
});
|
||||
proc.stdin.end();
|
||||
proc.stdin!.end();
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ export class TestEditorInput extends EditorInput implements IFileEditorInput {
|
|||
constructor(private resource: URI) { super(); }
|
||||
|
||||
getTypeId() { return 'testEditorInputForEditorService'; }
|
||||
resolve(): Promise<IEditorModel> { return !this.fails ? Promise.resolve(null) : Promise.reject(new Error('fails')); }
|
||||
resolve(): Promise<IEditorModel | null> { return !this.fails ? Promise.resolve(null) : Promise.reject(new Error('fails')); }
|
||||
matches(other: TestEditorInput): boolean { return other && other.resource && this.resource.toString() === other.resource.toString() && other instanceof TestEditorInput; }
|
||||
setEncoding(encoding: string) { }
|
||||
getEncoding() { return undefined; }
|
||||
|
|
|
@ -170,10 +170,10 @@ export class ExtensionHostProcessWorker implements IExtensionHostStarter {
|
|||
|
||||
// Catch all output coming from the extension host process
|
||||
type Output = { data: string, format: string[] };
|
||||
this._extensionHostProcess.stdout.setEncoding('utf8');
|
||||
this._extensionHostProcess.stderr.setEncoding('utf8');
|
||||
const onStdout = Event.fromNodeEventEmitter<string>(this._extensionHostProcess.stdout, 'data');
|
||||
const onStderr = Event.fromNodeEventEmitter<string>(this._extensionHostProcess.stderr, 'data');
|
||||
this._extensionHostProcess.stdout!.setEncoding('utf8');
|
||||
this._extensionHostProcess.stderr!.setEncoding('utf8');
|
||||
const onStdout = Event.fromNodeEventEmitter<string>(this._extensionHostProcess.stdout!, 'data');
|
||||
const onStderr = Event.fromNodeEventEmitter<string>(this._extensionHostProcess.stderr!, 'data');
|
||||
const onOutput = Event.any(
|
||||
Event.map(onStdout, o => ({ data: `%c${o}`, format: [''] })),
|
||||
Event.map(onStderr, o => ({ data: `%c${o}`, format: ['color: red'] }))
|
||||
|
|
|
@ -79,15 +79,15 @@ export class RipgrepTextSearchEngine {
|
|||
cancel();
|
||||
});
|
||||
|
||||
rgProc.stdout.on('data', data => {
|
||||
rgProc.stdout!.on('data', data => {
|
||||
ripgrepParser.handleData(data);
|
||||
});
|
||||
|
||||
let gotData = false;
|
||||
rgProc.stdout.once('data', () => gotData = true);
|
||||
rgProc.stdout!.once('data', () => gotData = true);
|
||||
|
||||
let stderr = '';
|
||||
rgProc.stderr.on('data', data => {
|
||||
rgProc.stderr!.on('data', data => {
|
||||
const message = data.toString();
|
||||
this.outputChannel.appendLine(message);
|
||||
stderr += message;
|
||||
|
|
Loading…
Reference in a new issue