From 1f24c7efa6deee574a4749df3ca25bc4aec5a2e8 Mon Sep 17 00:00:00 2001 From: BrainStone Date: Tue, 11 Oct 2022 01:28:54 +0200 Subject: [PATCH] Show proper shell mark depending on user --- src/lib/Util.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/lib/Util.js b/src/lib/Util.js index 2a47a20e..686bb613 100644 --- a/src/lib/Util.js +++ b/src/lib/Util.js @@ -2,6 +2,8 @@ const childProcess = require('child_process'); +const shellSymbol = (process.getuid() === 0) ? '#' : '$'; + module.exports = class Util { static isValidIPv4(str) { @@ -57,10 +59,10 @@ module.exports = class Util { } = {}) { if (typeof log === 'string') { // eslint-disable-next-line no-console - console.log(`$ ${log}`); + console.log(`${shellSymbol} ${log}`); } else if (log === true) { // eslint-disable-next-line no-console - console.log(`$ ${cmd}`); + console.log(`${shellSymbol} ${cmd}`); } if (process.platform !== 'linux') {