Skip to content
This repository has been archived by the owner on Jan 25, 2024. It is now read-only.

Commit

Permalink
fix(cli): exit gracefully
Browse files Browse the repository at this point in the history
  • Loading branch information
kwonoj committed Jul 13, 2018
1 parent 887af72 commit eb0ad7a
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,10 @@ const compile = async (

const sourceMapFile = options.sourceMapFile;
options.inputPath = inputPath.mountedFullPath;
const fileContext = context.file.create(inputPath.mountedFullPath);

//TODO: do we need to supply mountedpath instead?
//(sass-spec fails on some test with mounted path, cause output expects physical path instead)
const fileContext = context.file.create(inputPath.raw);
const sassContext = fileContext.getContext();
fileContext.options = options;
fileContext.compile();
Expand All @@ -252,7 +255,7 @@ const main = async (argv: Array<string> = process.argv) => {
const usageDefinition = displayHelp ? helpDefinitions : await buildDisplayVersion();
const usage = cmdUsage([...usageDefinition]);
console.log(usage);
return;
return 0;
}

const { loadModule } = await import('./loadModule');
Expand Down Expand Up @@ -290,12 +293,12 @@ const main = async (argv: Array<string> = process.argv) => {
.map(({ mountedDir }) => mountedDir)
.forEach(dir => interop.unmount(dir));

process.exit(result);
return result;
};

(async () => {
try {
await main();
process.exitCode = await main();
} catch (error) {
console.log(error);
process.exit(-1);
Expand Down

0 comments on commit eb0ad7a

Please sign in to comment.