Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

  • Options

Index

Properties

allowNonzeroExitCode?: boolean

Allow the opened app to exit with nonzero exit code when the wait option is true.

We do not recommend setting this option. The convention for success is exit code zero.

default

false

app?: App | readonly App[]

Specify the name of the app to open the target with, and optionally, app arguments. app can be an array of apps to try to open and name can be an array of app names to try. If each app fails, the last error will be thrown.

The app name is platform dependent. Don't hard code it in reusable modules. For example, Chrome is google chrome on macOS, google-chrome on Linux and chrome on Windows. If possible, use open.apps which auto-detects the correct binary to use.

You may also pass in the app's full path. For example on WSL, this can be /mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe for the Windows installation of Chrome.

The app arguments are app dependent. Check the app's documentation for what arguments it accepts.

background?: boolean

macOS only

Do not bring the app to the foreground.

default

false

newInstance?: boolean

macOS only

Open a new instance of the app even it's already running.

A new instance is always opened on other platforms.

default

false

wait?: boolean

Wait for the opened app to exit before fulfilling the promise. If false it's fulfilled immediately when opening the app.

Note that it waits for the app to exit, not just for the window to close.

On Windows, you have to explicitly specify an app for it to be able to wait.

default

false