From 09ea75823c25e020121fc9fc89e7bc3073ac1672 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 0e6317cb4d3e3c..a907c6cc686bb5 100644 --- a/doc/api/cli.md +++ b/doc/api/cli.md @@ -1613,6 +1613,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`