Skip to content

Commit

Permalink
backend: Fixed start process on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
CSantosM committed Oct 22, 2024
1 parent 53d2ddc commit e15c973
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion backend/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,17 @@ const startServer = (app: express.Application) => {
* @returns {boolean} True if this module is the main entry point, false otherwise.
*/
const isMainModule = (): boolean => {
return import.meta.url === `file://${process.argv[1]}`;
const importMetaUrl = import.meta.url;
let processArgv1 = process.argv[1];

if (process.platform === "win32") {
processArgv1 = processArgv1.replace(/\\/g, "/");
processArgv1 = `file:///${processArgv1}`;
} else {
processArgv1 = `file://${processArgv1}`;
}

return importMetaUrl === processArgv1;
};

if (isMainModule()) {
Expand Down

0 comments on commit e15c973

Please sign in to comment.