# Help with trivial test on OS X and Windows

**URL:** <https://discourse.julialang.org/t/help-with-trivial-test-on-os-x-and-windows/12413>\
**Category:** Community\
**Tags:** package, announcement\
**Created:** [July 16, 2018, 11:28am UTC](https://discourse.julialang.org/t/help-with-trivial-test-on-os-x-and-windows/12413 "2018-07-16T11:28:06Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [July 16, 2018, 11:28am UTC](https://discourse.julialang.org/t/help-with-trivial-test-on-os-x-and-windows/12413/1 "2018-07-16T11:28:06Z")

</div>

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

> **[GitHub - tpapp/DefaultApplication.jl: Julia package for opening a file with...](https://github.com/tpapp/DefaultApplication.jl)**
>
> Julia package for opening a file with the default application determined by the OS. - GitHub - tpapp/DefaultApplication.jl: Julia package for opening a file with the default application determined ...

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

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

```

which should open a text file.

---

<div class="post-metadata">

**Author:** ![joa-quim](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/joa-quim/32/227_2.png) [@joa-quim](https://discourse.julialang.org/u/joa-quim)\
**Post date:** [July 16, 2018, 1:07pm UTC](https://discourse.julialang.org/t/help-with-trivial-test-on-os-x-and-windows/12413/2 "2018-07-16T13:07:48Z")

</div>

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

```julia
	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

---

<div class="post-metadata">

**Author:** ![goedman](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/goedman/32/217_2.png) [@goedman](https://discourse.julialang.org/u/goedman)\
**Post date:** [July 16, 2018, 1:15pm UTC](https://discourse.julialang.org/t/help-with-trivial-test-on-os-x-and-windows/12413/3 "2018-07-16T13:15:24Z")

</div>

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  
│ [Issues · tpapp/DefaultApplication.jl · GitHub](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(R) 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

---

<div class="post-metadata">

**Author:** ![magzpavz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/magzpavz/32/1822_2.png) [@magzpavz](https://discourse.julialang.org/u/magzpavz)\
**Post date:** [July 16, 2018, 3:12pm UTC](https://discourse.julialang.org/t/help-with-trivial-test-on-os-x-and-windows/12413/4 "2018-07-16T15:12:57Z")

</div>

Worked in Windows 10. It opened notepad

```julia
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
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)

```

---

<div class="post-metadata">

**Author:** ![cormullion](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cormullion/32/49131_2.png) [@cormullion](https://discourse.julialang.org/u/cormullion)\
**Post date:** [July 16, 2018, 5:32pm UTC](https://discourse.julialang.org/t/help-with-trivial-test-on-os-x-and-windows/12413/5 "2018-07-16T17:32:27Z")

</div>

Looks great, and does everything it should — on macOS.

Out of interest, is the message:

```julia
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…

---

<div class="post-metadata">

**Author:** ![johnh](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/johnh/32/3615_2.png) [@johnh](https://discourse.julialang.org/u/johnh)\
**Post date:** [July 16, 2018, 8:18pm UTC](https://discourse.julialang.org/t/help-with-trivial-test-on-os-x-and-windows/12413/6 "2018-07-16T20:18:48Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [July 17, 2018, 6:03am UTC](https://discourse.julialang.org/t/help-with-trivial-test-on-os-x-and-windows/12413/7 "2018-07-17T06:03:51Z")

</div>

It is not a message, but a return value.

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

---

<div class="post-metadata">

**Author:** ![PetrKryslUCSD](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/petrkryslucsd/32/215825_2.png) [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Post date:** [July 17, 2018, 6:11am UTC](https://discourse.julialang.org/t/help-with-trivial-test-on-os-x-and-windows/12413/8 "2018-07-17T06:11:03Z")

</div>

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

> [@Tamas\_Papp](#):
>
> add [GitHub - tpapp/DefaultApplication.jl: Julia package for opening a file with the default application determined by the OS.](https://github.com/tpapp/DefaultApplication.jl) julia\> import DefaultApplication julia\> DefaultApplication.test()

```julia
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

```

---

<div class="post-metadata">

**Author:** ![PetrKryslUCSD](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/petrkryslucsd/32/215825_2.png) [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Post date:** [July 17, 2018, 6:15am UTC](https://discourse.julialang.org/t/help-with-trivial-test-on-os-x-and-windows/12413/9 "2018-07-17T06:15:02Z")

</div>

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

Thanks for this very useful package!

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [July 21, 2018, 2:53pm UTC](https://discourse.julialang.org/t/help-with-trivial-test-on-os-x-and-windows/12413/10 "2018-07-21T14:53:31Z")

</div>

I would like to thank everyone who helped with testing. The package is now [registered](https://discourse.julialang.org/t/ann-defaultapplication-jl/12561).
