skratchdot / open-golang

Open a file, directory, or URI using the OS's default application for that object type. Optionally, you can specify an application to use.
MIT License
783 stars 65 forks source link

Add a function to "Wait" for opened program exit (macOS) #25

Open rnsc opened 4 years ago

rnsc commented 4 years ago

Hello,

I was wondering if you were open to add a function or a flag to Wait for the opened program to close. It's possible on macOS, with -W (-n and -F could also be used):

-W Causes open to wait until the applications it opens (or that were already open) have exited. > Use with the -n flag to allow open to function as an appropriate app for the $EDITOR environment

-n Open a new instance of the application(s) even if one is already running.`

-F Opens the application "fresh," that is, without restoring windows. Saved persistent state is lost, except for Untitled documents.`

I have a use case of this and discovered your library, but I resorted to going back to exec.Command() to be able to specify this.

Now, xdg-open doesn't have a wait for feature, and I don't think windows does either. So I understand if this feature is not desired.

Kind regards,