Before server startup, log to stderr
This commit is contained in:
parent
b687270207
commit
1b70e7d0df
1 changed files with 5 additions and 5 deletions
|
@ -5,17 +5,17 @@ const { once } = require('events');
|
||||||
|
|
||||||
const prettierContainerPath = process.argv[2];
|
const prettierContainerPath = process.argv[2];
|
||||||
if (prettierContainerPath == null || prettierContainerPath.length == 0) {
|
if (prettierContainerPath == null || prettierContainerPath.length == 0) {
|
||||||
sendResponse(makeError(`Prettier path argument was not specified or empty.\nUsage: ${process.argv[0]} ${process.argv[1]} prettier/path`));
|
process.stderr.write(`Prettier path argument was not specified or empty.\nUsage: ${process.argv[0]} ${process.argv[1]} prettier/path`);
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
fs.stat(prettierContainerPath, (err, stats) => {
|
fs.stat(prettierContainerPath, (err, stats) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
sendResponse(makeError(`Path '${prettierContainerPath}' does not exist.`));
|
process.stderr.write(`Path '${prettierContainerPath}' does not exist.`);
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!stats.isDirectory()) {
|
if (!stats.isDirectory()) {
|
||||||
sendResponse(makeError(`Path '${prettierContainerPath}' exists but is not a directory.`));
|
process.stderr.write(`Path '${prettierContainerPath}' exists but is not a directory.`);
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -27,10 +27,10 @@ const prettierPath = path.join(prettierContainerPath, 'node_modules/prettier');
|
||||||
try {
|
try {
|
||||||
prettier = await loadPrettier(prettierPath);
|
prettier = await loadPrettier(prettierPath);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
sendResponse(makeError(`Failed to load prettier: ${e}`));
|
process.stderr.write(`Failed to load prettier: ${e}`);
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
sendResponse(makeError("Prettier loadded successfully."));
|
process.stderr.write("Prettier loadded successfully.");
|
||||||
process.stdin.resume();
|
process.stdin.resume();
|
||||||
handleBuffer(prettier);
|
handleBuffer(prettier);
|
||||||
})()
|
})()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue