Help with trivial test on OS X and Windows

package
announcement

#1

Various libraries have a snippet for opening files in external programs using xgd-open (Linux), open (OS X), and cmd.exe (Windows), which are frequently sources of issues which are hard to replicate and track down. I thought this could be centralized in a single package, so I wrote

I tested on Linux, but I need help from testers on Windows and OS X. If you have a minute and you are already using v0.7, please help out by running

pkg> add https://github.com/tpapp/DefaultApplication.jl
julia> import DefaultApplication
julia> DefaultApplication.test()

which should open a text file.


[ANN] DefaultApplication.jl
#2

What I use on Windows for that purpose is explorer, not cmd. Basically I do

	if (Sys.iswindows()) run(ignorestatus(`explorer $out`))
	elseif (is_apple()) run(`open $(out)`)
	elseif (is_linux()) run(`xdg-open $(out)`)

where out is the file name.

โ€ฆ and this just made me realized that my pert to 0.7 is incomplete and works only on Windows


#3

Hi Tamas,

Works fine on OSX:

julia> import DefaultApplication

julia> DefaultApplication.test()
โ”Œ Info: opening text file with the default application
โ”” path = โ€œ/var/folders/fb/m164mwfn3v1btnrpmmyzpvqh0000gn/T/juliaXPmD7d.txtโ€
โ”Œ Info: If the file was not opened, please copy the output and open an issue at
โ”‚ https://github.com/tpapp/DefaultApplication.jl/issues
โ”‚ KERNEL = :Darwin
โ”” VERSION = v"0.7.0-beta2.15"
Process(open /var/folders/fb/m164mwfn3v1btnrpmmyzpvqh0000gn/T/juliaXPmD7d.txt, ProcessExited(0))

and TextEdit appears.

julia> versioninfo()
Julia Version 0.7.0-beta2.15
Commit 199b74e853* (2018-07-16 12:23 UTC)
Platform Info:
OS: macOS (x86_64-apple-darwin17.7.0)
CPU: Intelยฎ Coreโ„ข i5-6267U CPU @ 2.90GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-6.0.0 (ORCJIT, skylake)
Environment:
JULIA_PKG3_PRECOMPILE = true
JULIA_EDITOR = see
JULIA_SVG_BROWSER = Google Chrome.app


#4

Worked in Windows 10. It opened notepad

julia> import DefaultApplication

julia> DefaultApplication.test()
โ”Œ Info: opening text file with the default application
โ””   path = "C:\\Users\\username\\AppData\\Local\\Temp\\1\\jl_483D.tmp.txt"
โ”Œ Info: If the file was not opened, please copy the output and open an issue at
โ”‚ https://github.com/tpapp/DefaultApplication.jl/issues
โ”‚   KERNEL = :NT
โ””   VERSION = v"0.7.0-beta2.0"
โ”Œ Info: Version information for windows
โ””   windows_version = v"10.0.16299"
Process(`'C:\WINDOWS\system32\cmd.exe' /c start 'C:\Users\username\AppData\Local\Temp\1\jl_483D.tmp.txt'`, ProcessExited(0))

version details:

julia> versioninfo()
Julia Version 0.7.0-beta2.0
Commit b145832402* (2018-07-13 19:54 UTC)
Platform Info:
  OS: Windows (x86_64-w64-mingw32)
  CPU: Intel(R) Xeon(R) CPU E5-2640 v3 @ 2.60GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-6.0.0 (ORCJIT, haswell)

#5

Looks great, and does everything it should โ€” on macOS.

Out of interest, is the message:

Process(`open /tmp/mdtable.md`, ProcessExited(0))

controllable via the DefaultApplication.open() function? I quite fancy not seeing it by default (I think itโ€™s a new thing in v0.7โ€ฆ)

Perhaps Iโ€™ll switch to using DefaultApplication.jl soonโ€ฆ


#6

On Windows 10
julia> versioninfo()
Julia Version 0.7.0-beta2.0
Commit b145832402* (2018-07-13 19:54 UTC)
Platform Info:
OS: Windows (x86_64-w64-mingw32)

Opens a Notepad window


#7

It is not a message, but a return value.

Normally DefaultApplication.open would be called by a function, so you would not see it.


#8

EDIT: my bad, it was the pasted expression that caused the error. The notepad opened okay.

julia> julia> DefaultApplication.test()
โ”Œ Info: opening text file with the default application
โ””   path = "C:\\Users\\PETRKR~1\\AppData\\Local\\Temp\\jl_A44.tmp.txt"
โ”Œ Info: If the file was not opened, please copy the output and open an issue at
โ”‚ https://github.com/tpapp/DefaultApplication.jl/issues
โ”‚   KERNEL = :NT
โ””   VERSION = v"0.7.0-beta2.12"
โ”Œ Info: Version information for windows
โ””   windows_version = v"10.0.17134"
ERROR: UndefVarError: julia not defined
Stacktrace:
 [1] top-level scope at none:0

#9

I changed the default application for .txt files to be VS code: it worked beautifully.

Thanks for this very useful package!


#10

I would like to thank everyone who helped with testing. The package is now registered.