mirror of
https://github.com/balena-io/balena-cli.git
synced 2025-02-11 13:16:12 +00:00
Enable long stack traces for --debug
as well as DEBUG=1
Change-type: patch
This commit is contained in:
parent
15ed67422d
commit
f6ca5ef397
@ -218,28 +218,6 @@ function setupBalenaSdkSharedOptions(settings: CliSettings) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
let BluebirdConfigured = false;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Configure Bluebird and assign it as the global promise library.
|
|
||||||
* Modules like `stream-to-promise` will otherwise produce native promises,
|
|
||||||
* which leads to errors as much of the CLI JavaScript code expects Bluebird
|
|
||||||
* promises.
|
|
||||||
*/
|
|
||||||
export function configureBluebird() {
|
|
||||||
if (BluebirdConfigured) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
BluebirdConfigured = true;
|
|
||||||
const Bluebird = require('bluebird') as typeof import('bluebird');
|
|
||||||
Bluebird.config({
|
|
||||||
longStackTraces: process.env.DEBUG ? true : false,
|
|
||||||
});
|
|
||||||
if (!(global as any)['@@any-promise/REGISTRATION']) {
|
|
||||||
require('any-promise/register/bluebird');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Addresses the console warning:
|
* Addresses the console warning:
|
||||||
* (node:49500) MaxListenersExceededWarning: Possible EventEmitter memory
|
* (node:49500) MaxListenersExceededWarning: Possible EventEmitter memory
|
||||||
@ -253,7 +231,6 @@ export function setMaxListeners(maxListeners: number) {
|
|||||||
export async function globalInit() {
|
export async function globalInit() {
|
||||||
await setupSentry();
|
await setupSentry();
|
||||||
checkNodeVersion();
|
checkNodeVersion();
|
||||||
configureBluebird();
|
|
||||||
|
|
||||||
const settings = new CliSettings();
|
const settings = new CliSettings();
|
||||||
|
|
||||||
|
@ -61,6 +61,13 @@ export async function routeCliFramework(argv: string[], options: AppOptions) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Enable bluebird long stack traces when in debug mode, must be set
|
||||||
|
// before the first bluebird require - done here so that it will also
|
||||||
|
// be enabled when using the `--debug` flag to enable debug mode
|
||||||
|
if (process.env.DEBUG) {
|
||||||
|
process.env.BLUEBIRD_LONG_STACK_TRACES = '1';
|
||||||
|
}
|
||||||
|
|
||||||
const Logger = await import('./utils/logger');
|
const Logger = await import('./utils/logger');
|
||||||
Logger.command = cmdSlice[0];
|
Logger.command = cmdSlice[0];
|
||||||
|
|
||||||
|
@ -185,7 +185,6 @@
|
|||||||
"@types/update-notifier": "^4.1.0",
|
"@types/update-notifier": "^4.1.0",
|
||||||
"@zeit/dockerignore": "0.0.3",
|
"@zeit/dockerignore": "0.0.3",
|
||||||
"JSONStream": "^1.0.3",
|
"JSONStream": "^1.0.3",
|
||||||
"any-promise": "^1.3.0",
|
|
||||||
"archiver": "^3.1.1",
|
"archiver": "^3.1.1",
|
||||||
"balena-config-json": "^4.0.0",
|
"balena-config-json": "^4.0.0",
|
||||||
"balena-device-init": "^5.0.2",
|
"balena-device-init": "^5.0.2",
|
||||||
|
@ -15,9 +15,8 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { configureBluebird, setMaxListeners } from '../build/app-common';
|
import { setMaxListeners } from '../build/app-common';
|
||||||
|
|
||||||
configureBluebird();
|
|
||||||
setMaxListeners(35); // it appears that 'nock' adds a bunch of listeners - bug?
|
setMaxListeners(35); // it appears that 'nock' adds a bunch of listeners - bug?
|
||||||
// SL: Looks like it's not nock causing this, as have seen the problem triggered from help.spec,
|
// SL: Looks like it's not nock causing this, as have seen the problem triggered from help.spec,
|
||||||
// which is not using nock. Perhaps mocha/chai? (unlikely), or something in the CLI?
|
// which is not using nock. Perhaps mocha/chai? (unlikely), or something in the CLI?
|
||||||
|
@ -15,10 +15,6 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { configureBluebird } from '../build/app-common';
|
|
||||||
|
|
||||||
configureBluebird();
|
|
||||||
|
|
||||||
import * as nock from 'nock';
|
import * as nock from 'nock';
|
||||||
|
|
||||||
export interface ScopeOpts {
|
export interface ScopeOpts {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user