Skip to content

Commit

Permalink
Fix issue #236. Additional option "hiddenTerminal"
Browse files Browse the repository at this point in the history
  • Loading branch information
Pavel Kukushkin committed Mar 21, 2021
1 parent 8881dab commit 7f0b6a4
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
10 changes: 8 additions & 2 deletions index.js
Expand Up @@ -77,6 +77,7 @@ const open = async (target, options) => {
options = {
wait: false,
background: false,
hiddenTerminal: false,
allowNonzeroExitCode: false,
...options
};
Expand Down Expand Up @@ -125,13 +126,18 @@ const open = async (target, options) => {
`${mountPoint}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe` :
`${process.env.SYSTEMROOT}\\System32\\WindowsPowerShell\\v1.0\\powershell`;

if (options.hiddenTerminal) {
cliArguments.push(
'–WindowStyle',
'Hidden',
);
}

cliArguments.push(
'-NoProfile',
'-NonInteractive',
'–ExecutionPolicy',
'Bypass',
'–WindowStyle',
'Hidden',
'-EncodedCommand'
);

Expand Down
7 changes: 7 additions & 0 deletions readme.md
Expand Up @@ -80,6 +80,13 @@ Default: `false`

Do not bring the app to the foreground.

##### hiddenTerminal <sup>(Windows only)</sup>

Type: `boolean`\
Default: `false`

Hide PowerShell terminal. If your node script is called from some gui application (from pkg-bundled app, from nodegui, etc.), than addition PowerShell window would be spawned. With this option `true` this window will be hidden.

##### app

Type: `{name: string | string[], arguments?: string[]} | Array<{name: string | string[], arguments: string[]}>`
Expand Down

0 comments on commit 7f0b6a4

Please sign in to comment.