On 16/09/14 12:31, Marek Safar wrote:
Linux, it's not. i do not think this is a Mono issue, but will it be better
to help set the execute permission if Process.Start calls a non-executable
file? or at least provide a more friendly exception, current the error
message is 'Cannot find the specified file', which is confusing.

We cannot just set the execution permission but reporting more useful
exception is good idea. Could you fill bug/enhancement report for this.

There are a few use-cases to consider, if we want to automate any kind of best effort.

If you really mean to execute an ELF binary which lacks execute permissions, call "/lib/ld-linux.so.2 thing"

If you really mean to execute any kind of script (i.e. a file whose first two characters are "#!") then call "/bin/sh thing"

If you really mean to execute an arbitrary file (Process.Start("foo.xlsx") will open foo.xlsx in Excel, on Windows, for example) then call "/usr/bin/xdg-open thing" - this is probably the most useful use-case, and is also valid when thing is a URL, opening in the default browser.

Only after those three cases are exhausted unsuccessfully is "just throw an exception" the best option. We already recently gained support for Process.Start("monoassembly.exe") without needing binfmt-tools, which is handy. Of the three cases I listed above, I'd say #3 is quite important for user tools behaving in a coherent cross-platform manner, #2 is nice to have, and #1 is so unlikely to ever be needed as to be useless.
_______________________________________________
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list

Reply via email to