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

Commit

Permalink
Fix issue where --follow fails with unhelpful error message, if the l…
Browse files Browse the repository at this point in the history
…og file does not exist
  • Loading branch information
jeffsmale90 committed Mar 6, 2023
1 parent d653a15 commit 84a114c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 13 deletions.
6 changes: 4 additions & 2 deletions src/packages/cli/src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,10 @@ if (argv.action === "start") {

stream.on("error", err => {
if ((err as NodeJS.ErrnoException).code === "ENOENT") {
console.log(
`No logs are available for ${instanceName}.\nTry calling some RPC methods.`
console.error(
`No logs found for ${porscheColor(
instanceName
)}. The log file may have been deleted.\n\nYou may need to restart the instance.`
);
}
});
Expand Down
13 changes: 2 additions & 11 deletions src/packages/cli/src/logs-stream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,19 +107,10 @@ export function createFollowReadStream(filename: string): Readable {
watcher.close();
createStream();
});
});
})
.on("error", err => followStream.emit("error", err));
}
createStream();

return followStream;
}

function readFromBuffers(buffers: Buffer[], size?: number) {
const entireBuffer = Buffer.concat(buffers.splice(0, buffers.length));
if (size == undefined || size <= entireBuffer.length) {
return entireBuffer;
} else {
buffers.push(entireBuffer.slice(size + 1));
return entireBuffer.slice(0, size);
}
}

0 comments on commit 84a114c

Please sign in to comment.