From 279dd5e447fbc07ba9580e72aaf566e6c21eb420 Mon Sep 17 00:00:00 2001 From: Debadree Chatterjee Date: Mon, 12 Dec 2022 03:53:11 +0530 Subject: [PATCH] watch: add CLI flag to preserve output Fixes: https://github.com/nodejs/node/issues/45713 PR-URL: https://github.com/nodejs/node/pull/45717 Reviewed-By: Antoine du Hamel Reviewed-By: Moshe Atlow --- doc/api/cli.md | 9 +++++++++ lib/internal/main/watch_mode.js | 6 ++++-- src/node_options.cc | 4 ++++ src/node_options.h | 1 + test/sequential/test-watch-mode.mjs | 25 +++++++++++++++++++++++++ 5 files changed, 43 insertions(+), 2 deletions(-) diff --git a/doc/api/cli.md b/doc/api/cli.md index c09066a29a1dec..988ded3d679ced 100644 --- a/doc/api/cli.md +++ b/doc/api/cli.md @@ -1628,6 +1628,14 @@ This option is only supported on macOS and Windows. An `ERR_FEATURE_UNAVAILABLE_ON_PLATFORM` exception will be thrown when the option is used on a platform that does not support it. +### `--watch-preserve-output` + +Disable the clearing of the console when watch mode restarts the process. + +```console +$ node --watch --watch-preserve-output test.js +``` + ### `--zero-fill-buffers`