Refactors exec invocation in PdfCliExecutor
Moves the promisify exec function outside the render method for clarity and potential reuse, improving code structure.
This commit is contained in:
1 file changed
+2
-2
@@ -10,6 +10,8 @@ import { BinaryLocator } from './BinaryLocator';
|
|||||||
import { EnvironmentUtils } from './EnvironmentUtils';
|
import { EnvironmentUtils } from './EnvironmentUtils';
|
||||||
import type { obsidianTypstPDFExport } from '../../../main';
|
import type { obsidianTypstPDFExport } from '../../../main';
|
||||||
|
|
||||||
|
const execAsync = promisify(exec);
|
||||||
|
|
||||||
export interface PdfCliOptions {
|
export interface PdfCliOptions {
|
||||||
/** Scale factor for the rendered image */
|
/** Scale factor for the rendered image */
|
||||||
scale: number;
|
scale: number;
|
||||||
@@ -113,8 +115,6 @@ export class PdfCliExecutor {
|
|||||||
plugin?: obsidianTypstPDFExport
|
plugin?: obsidianTypstPDFExport
|
||||||
): Promise<PdfCliResult> {
|
): Promise<PdfCliResult> {
|
||||||
try {
|
try {
|
||||||
const execAsync = promisify(exec);
|
|
||||||
|
|
||||||
// Get augmented environment for CLI execution
|
// Get augmented environment for CLI execution
|
||||||
const env = EnvironmentUtils.getAugmentedEnvironment(plugin?.settings);
|
const env = EnvironmentUtils.getAugmentedEnvironment(plugin?.settings);
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user