diff --git a/x-pack/plugins/reporting/server/browsers/chromium/driver_factory/index.ts b/x-pack/plugins/reporting/server/browsers/chromium/driver_factory/index.ts index c87c202c0ec1f..2170b50f195b4 100644 --- a/x-pack/plugins/reporting/server/browsers/chromium/driver_factory/index.ts +++ b/x-pack/plugins/reporting/server/browsers/chromium/driver_factory/index.ts @@ -7,9 +7,9 @@ import apm from 'elastic-apm-node'; import { i18n } from '@kbn/i18n'; +import { getDataPath } from '@kbn/utils'; import del from 'del'; import fs from 'fs'; -import os from 'os'; import path from 'path'; import puppeteer from 'puppeteer'; import * as Rx from 'rxjs'; @@ -59,7 +59,7 @@ export class HeadlessChromiumDriverFactory { logger.warning(`Enabling the Chromium sandbox provides an additional layer of protection.`); } - this.userDataDir = fs.mkdtempSync(path.join(os.tmpdir(), 'chromium-')); + this.userDataDir = fs.mkdtempSync(path.join(getDataPath(), 'chromium-')); this.getChromiumArgs = (viewport: ViewportConfig) => args({ userDataDir: this.userDataDir, diff --git a/x-pack/plugins/reporting/server/browsers/chromium/driver_factory/start_logs.ts b/x-pack/plugins/reporting/server/browsers/chromium/driver_factory/start_logs.ts index 9cfd0949eba99..aa27e46b85acb 100644 --- a/x-pack/plugins/reporting/server/browsers/chromium/driver_factory/start_logs.ts +++ b/x-pack/plugins/reporting/server/browsers/chromium/driver_factory/start_logs.ts @@ -10,9 +10,10 @@ import { spawn } from 'child_process'; import del from 'del'; import { mkdtempSync } from 'fs'; import { uniq } from 'lodash'; -import os, { tmpdir } from 'os'; +import os from 'os'; import { join } from 'path'; import { createInterface } from 'readline'; +import { getDataPath } from '@kbn/utils'; import { fromEvent, merge, of, timer } from 'rxjs'; import { catchError, map, reduce, takeUntil, tap } from 'rxjs/operators'; import { ReportingCore } from '../../../'; @@ -61,7 +62,7 @@ export const browserStartLogs = ( const config = core.getConfig(); const proxy = config.get('capture', 'browser', 'chromium', 'proxy'); const disableSandbox = config.get('capture', 'browser', 'chromium', 'disableSandbox'); - const userDataDir = mkdtempSync(join(tmpdir(), 'chromium-')); + const userDataDir = mkdtempSync(join(getDataPath(), 'chromium-')); const platform = process.platform; const architecture = os.arch();