From 60364f15a42b37c69f65f5cc02aa55b9a0ea3a31 Mon Sep 17 00:00:00 2001 From: Kacper Wiszczuk Date: Sun, 5 Apr 2020 22:44:43 +0200 Subject: [PATCH] fix: Use correct terminal on linux systems --- packages/tools/src/getDefaultUserTerminal.ts | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/packages/tools/src/getDefaultUserTerminal.ts b/packages/tools/src/getDefaultUserTerminal.ts index a5bf91914..fb07ea1b7 100644 --- a/packages/tools/src/getDefaultUserTerminal.ts +++ b/packages/tools/src/getDefaultUserTerminal.ts @@ -1,4 +1,17 @@ -const getDefaultUserTerminal = (): string | undefined => - process.env.REACT_TERMINAL || process.env.TERM_PROGRAM; +import os from 'os'; + +const getDefaultUserTerminal = (): string | undefined => { + const {REACT_TERMINAL, TERM_PROGRAM, TERM} = process.env; + + if (REACT_TERMINAL) { + return REACT_TERMINAL; + } + + if (os.platform() === 'darwin') { + return TERM_PROGRAM; + } + + return TERM; +}; export default getDefaultUserTerminal;