mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-31 17:23:31 -05:00
Merge vscode 1.67 (#20883)
* Fix initial build breaks from 1.67 merge (#2514) * Update yarn lock files * Update build scripts * Fix tsconfig * Build breaks * WIP * Update yarn lock files * Misc breaks * Updates to package.json * Breaks * Update yarn * Fix breaks * Breaks * Build breaks * Breaks * Breaks * Breaks * Breaks * Breaks * Missing file * Breaks * Breaks * Breaks * Breaks * Breaks * Fix several runtime breaks (#2515) * Missing files * Runtime breaks * Fix proxy ordering issue * Remove commented code * Fix breaks with opening query editor * Fix post merge break * Updates related to setup build and other breaks (#2516) * Fix bundle build issues * Update distro * Fix distro merge and update build JS files * Disable pipeline steps * Remove stats call * Update license name * Make new RPM dependencies a warning * Fix extension manager version checks * Update JS file * Fix a few runtime breaks * Fixes * Fix runtime issues * Fix build breaks * Update notebook tests (part 1) * Fix broken tests * Linting errors * Fix hygiene * Disable lint rules * Bump distro * Turn off smoke tests * Disable integration tests * Remove failing "activate" test * Remove failed test assertion * Disable other broken test * Disable query history tests * Disable extension unit tests * Disable failing tasks
This commit is contained in:
106
src/bootstrap-fork.js
vendored
106
src/bootstrap-fork.js
vendored
@@ -37,9 +37,6 @@ if (process.env['VSCODE_PARENT_PID']) {
|
||||
terminateWhenParentTerminates();
|
||||
}
|
||||
|
||||
// Configure Crash Reporter
|
||||
configureCrashReporter();
|
||||
|
||||
// Load AMD entry point
|
||||
require('./bootstrap-amd').load(process.env['VSCODE_AMD_ENTRYPOINT']);
|
||||
|
||||
@@ -47,12 +44,13 @@ require('./bootstrap-amd').load(process.env['VSCODE_AMD_ENTRYPOINT']);
|
||||
//#region Helpers
|
||||
|
||||
function pipeLoggingToParent() {
|
||||
const MAX_STREAM_BUFFER_LENGTH = 1024 * 1024;
|
||||
const MAX_LENGTH = 100000;
|
||||
|
||||
/**
|
||||
* Prevent circular stringify and convert arguments to real array
|
||||
*
|
||||
* @param {IArguments} args
|
||||
* @param {ArrayLike<unknown>} args
|
||||
*/
|
||||
function safeToArray(args) {
|
||||
const seen = [];
|
||||
@@ -61,26 +59,27 @@ function pipeLoggingToParent() {
|
||||
// Massage some arguments with special treatment
|
||||
if (args.length) {
|
||||
for (let i = 0; i < args.length; i++) {
|
||||
let arg = args[i];
|
||||
|
||||
// Any argument of type 'undefined' needs to be specially treated because
|
||||
// JSON.stringify will simply ignore those. We replace them with the string
|
||||
// 'undefined' which is not 100% right, but good enough to be logged to console
|
||||
if (typeof args[i] === 'undefined') {
|
||||
args[i] = 'undefined';
|
||||
if (typeof arg === 'undefined') {
|
||||
arg = 'undefined';
|
||||
}
|
||||
|
||||
// Any argument that is an Error will be changed to be just the error stack/message
|
||||
// itself because currently cannot serialize the error over entirely.
|
||||
else if (args[i] instanceof Error) {
|
||||
const errorObj = args[i];
|
||||
else if (arg instanceof Error) {
|
||||
const errorObj = arg;
|
||||
if (errorObj.stack) {
|
||||
args[i] = errorObj.stack;
|
||||
arg = errorObj.stack;
|
||||
} else {
|
||||
args[i] = errorObj.toString();
|
||||
arg = errorObj.toString();
|
||||
}
|
||||
}
|
||||
|
||||
argsArray.push(args[i]);
|
||||
argsArray.push(arg);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -151,26 +150,76 @@ function pipeLoggingToParent() {
|
||||
safeSend({ type: '__$console', severity, arguments: args });
|
||||
}
|
||||
|
||||
let isMakingConsoleCall = false;
|
||||
|
||||
/**
|
||||
* Wraps a console message so that it is transmitted to the renderer. If
|
||||
* native logging is turned on, the original console message will be written
|
||||
* as well. This is needed since the console methods are "magic" in V8 and
|
||||
* are the only methods that allow later introspection of logged variables.
|
||||
*
|
||||
* The wrapped property is not defined with `writable: false` to avoid
|
||||
* throwing errors, but rather a no-op setting. See https://github.com/microsoft/vscode-extension-telemetry/issues/88
|
||||
*
|
||||
* @param {'log' | 'info' | 'warn' | 'error'} method
|
||||
* @param {'log' | 'warn' | 'error'} severity
|
||||
*/
|
||||
function wrapConsoleMethod(method, severity) {
|
||||
if (process.env['VSCODE_LOG_NATIVE'] === 'true') {
|
||||
const original = console[method];
|
||||
console[method] = function () {
|
||||
safeSendConsoleMessage(severity, safeToArray(arguments));
|
||||
|
||||
const stream = method === 'error' || method === 'warn' ? process.stderr : process.stdout;
|
||||
stream.write('\nSTART_NATIVE_LOG\n');
|
||||
original.apply(console, arguments);
|
||||
stream.write('\nEND_NATIVE_LOG\n');
|
||||
};
|
||||
const stream = method === 'error' || method === 'warn' ? process.stderr : process.stdout;
|
||||
Object.defineProperty(console, method, {
|
||||
set: () => { },
|
||||
get: () => function () {
|
||||
safeSendConsoleMessage(severity, safeToArray(arguments));
|
||||
isMakingConsoleCall = true;
|
||||
stream.write('\nSTART_NATIVE_LOG\n');
|
||||
original.apply(console, arguments);
|
||||
stream.write('\nEND_NATIVE_LOG\n');
|
||||
isMakingConsoleCall = false;
|
||||
},
|
||||
});
|
||||
} else {
|
||||
console[method] = function () { safeSendConsoleMessage(severity, safeToArray(arguments)); };
|
||||
Object.defineProperty(console, method, {
|
||||
set: () => { },
|
||||
get: () => function () { safeSendConsoleMessage(severity, safeToArray(arguments)); },
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Wraps process.stderr/stdout.write() so that it is transmitted to the
|
||||
* renderer or CLI. It both calls through to the original method as well
|
||||
* as to console.log with complete lines so that they're made available
|
||||
* to the debugger/CLI.
|
||||
*
|
||||
* @param {'stdout' | 'stderr'} streamName
|
||||
* @param {'log' | 'warn' | 'error'} severity
|
||||
*/
|
||||
function wrapStream(streamName, severity) {
|
||||
const stream = process[streamName];
|
||||
const original = stream.write;
|
||||
|
||||
/** @type string */
|
||||
let buf = '';
|
||||
|
||||
Object.defineProperty(stream, 'write', {
|
||||
set: () => { },
|
||||
get: () => (chunk, encoding, callback) => {
|
||||
if (!isMakingConsoleCall) {
|
||||
buf += chunk.toString(encoding);
|
||||
const eol = buf.length > MAX_STREAM_BUFFER_LENGTH ? buf.length : buf.lastIndexOf('\n');
|
||||
if (eol !== -1) {
|
||||
console[severity](buf.slice(0, eol));
|
||||
buf = buf.slice(eol + 1);
|
||||
}
|
||||
}
|
||||
|
||||
original.call(stream, chunk, encoding, callback);
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
// Pass console logging to the outside so that we have it in the main side if told so
|
||||
if (process.env['VSCODE_VERBOSE_LOGGING'] === 'true') {
|
||||
wrapConsoleMethod('info', 'log');
|
||||
@@ -183,6 +232,9 @@ function pipeLoggingToParent() {
|
||||
console.info = function () { /* ignore */ };
|
||||
wrapConsoleMethod('error', 'error');
|
||||
}
|
||||
|
||||
wrapStream('stderr', 'error');
|
||||
wrapStream('stdout', 'log');
|
||||
}
|
||||
|
||||
function handleExceptions() {
|
||||
@@ -212,18 +264,4 @@ function terminateWhenParentTerminates() {
|
||||
}
|
||||
}
|
||||
|
||||
function configureCrashReporter() {
|
||||
const crashReporterOptionsRaw = process.env['VSCODE_CRASH_REPORTER_START_OPTIONS'];
|
||||
if (typeof crashReporterOptionsRaw === 'string') {
|
||||
try {
|
||||
const crashReporterOptions = JSON.parse(crashReporterOptionsRaw);
|
||||
if (crashReporterOptions && process['crashReporter'] /* Electron only */) {
|
||||
process['crashReporter'].start(crashReporterOptions);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//#endregion
|
||||
|
||||
Reference in New Issue
Block a user