-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Eben60
committed
Jan 11, 2025
1 parent
84211b6
commit 297219f
Showing
4 changed files
with
48 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
module MacroUnsafe | ||
|
||
using Blink, Blink.AtomShell | ||
using Sockets: @ip_str | ||
|
||
using Blink.AtomShell: port, inspector, try_connect, electron, initcbs, mainjs | ||
|
||
""" | ||
@unsafe | ||
A workaround for an upstream bug on Ubuntu 24. It disables sandboxing in Electron. | ||
Run this macro before calling `gogui()`. | ||
The recommended way of using PackageMaker on Ubuntu 24 is however to use from VSCode, as | ||
in this case it works OK without calling `@unsafe` | ||
# Examples | ||
```julia-repl | ||
julia> @unsafe; | ||
julia> gogui() | ||
``` | ||
""" | ||
macro unsafe() # https://github.com/JuliaGizmos/Blink.jl/issues/325#issuecomment-2252670794 | ||
return quote | ||
function Blink.AtomShell.init(; debug = false) | ||
electron() # Check path exists | ||
p, dp = port(), port() | ||
debug && inspector(dp) | ||
dbg = debug ? "--debug=$dp" : [] | ||
proc = (debug ? run_rdr : run)( | ||
`$(electron()) --no-sandbox $dbg $mainjs port $p`; wait=false) | ||
conn = try_connect(ip"127.0.0.1", p) | ||
shell = Electron(proc, conn) | ||
initcbs(shell) | ||
return shell | ||
end | ||
end | ||
end | ||
export @unsafe | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters