Skip to content

Commit

Permalink
fix: chdir back to the starting directory before exit
Browse files Browse the repository at this point in the history
  • Loading branch information
aeworxet committed May 24, 2024
1 parent cc59d5e commit 49530f3
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ import { parse } from './parser';

import type { AsyncAPIObject } from './spec-types';

// remember the directory where execution of the program started
export const originDir = String(process.env.PWD);

/**
*
* @param {string | string[]} files One or more relative/absolute paths to
Expand Down Expand Up @@ -84,6 +81,9 @@ export default async function bundle(
files: string[] | string,
options: any = {}
) {
// remember the directory where execution of the program started
const originDir = String(process.env.PWD);

// if one string was passed, convert it to an array
if (typeof files === 'string') {
files = Array.from(files.split(' '));
Expand Down Expand Up @@ -119,7 +119,7 @@ export default async function bundle(

// return to the starting directory before finishing the execution
if (options.baseDir) {
process.chdir(originDir);
process.chdir(originDir);
}

return new Document(resolvedJsons, options.base);
Expand Down

0 comments on commit 49530f3

Please sign in to comment.