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

Files don't open on windows when called externally (but don't error either) #33

Open mikeparker opened 1 year ago

mikeparker commented 1 year ago

I've written some very simple code to just open a text file

    err = open.Run("C:/test.txt")
    if err != nil {
        return err
    }

When I run this executable from the command line, it works fine. When I run another executable which then runs this executable, the code no longer works, but there is no error.

The weird thing is that when mypath is a directory, windows will happily open file explorer at that directory, even when being called from another executable:

    err = open.Run("C:/")
    if err != nil {
        return err
    }

^ This works fine. But any file will not.

If there's some permissions issue going on that's fine but shouldn't this return an error if it's not able to complete? Any insight into what's going on here would be welcomed too.