From cee6f382d88f3b53796370d3c98ae7b225755fc7 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 f78ba6515e2c81..258b5bdef34960 100644 --- a/doc/api/cli.md +++ b/doc/api/cli.md @@ -1627,6 +1627,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`