How to reproduce
Use this loader without emsdk
Expected
An error will be thrown by utility.getDependencies().
|
const { stdout } = await execute(compiler, [ |
|
...flags, |
|
'-MM', |
|
absPath, |
|
]).catch(err => { |
|
throw err.err; |
|
}); |
What happened
It doesn't throw anything and returns an empty array. As a result, utility.getLatestModifiedTime() throws an error:
ERROR in ./src/main.clist
Module build failed (from ../../emcc-loader/lib/index.js):
Error: paths must be non-empty.
at getLatestModifiedTime (/Users/nandenjin/workspace/emcc-loader/lib/index.js:63:15)
at Compiler.compile (/Users/nandenjin/workspace/emcc-loader/lib/index.js:230:42)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at async Compiler.process (/Users/nandenjin/workspace/emcc-loader/lib/index.js:203:30)
@ ./src/index.ts 12:0-34 30:22-39
How to fix
utility.execute() is designed that it passes error as its return value instead of throwing it.
|
return new Promise<SuccessType>((resolve, reject) => { |
|
childProcess.execFile( |
|
childProcessExecutable, |
|
childProcessArguments, |
|
options || {}, |
|
(err, stdout, stderr) => { |
|
if (err) { |
|
resolve({ |
|
err, |
|
stdout, |
|
stderr, |
|
}); |
|
} else { |
|
resolve({ |
|
stdout, |
|
stderr, |
|
}); |
|
} |
|
} |
|
); |
|
}); |
So, it may be fixed with detecting errors with return value instead of using .catch()
How to reproduce
Use this loader without
emsdkExpected
An error will be thrown by
utility.getDependencies().emcc-loader/src/utility.ts
Lines 24 to 30 in 2a3c0ba
What happened
It doesn't throw anything and returns an empty array. As a result,
utility.getLatestModifiedTime()throws an error:How to fix
utility.execute()is designed that it passes error as its return value instead of throwing it.emcc-loader/src/utility.ts
Lines 98 to 118 in 2a3c0ba
So, it may be fixed with detecting errors with return value instead of using
.catch()