mirror of https://github.com/Hilbis/Hilbish
Compare commits
1 Commits
a68b488828
...
70c2b91fca
Author | SHA1 | Date |
---|---|---|
sammyette | 70c2b91fca |
|
@ -29,7 +29,7 @@ jobs:
|
|||
- name: Setup Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: '1.22.2'
|
||||
go-version: '1.18.8'
|
||||
- name: Download Task
|
||||
run: 'sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d'
|
||||
- name: Build
|
||||
|
|
|
@ -30,9 +30,6 @@ hilbish.run('wc -l', {
|
|||
|
||||
### Fixed
|
||||
- Fix ansi attributes causing issues with text when cut off in greenhouse
|
||||
- `exec` command should return if no arg presented
|
||||
- Commanders can now be cancelled by Ctrl-C and wont hang the shell anymore.
|
||||
See [issue 198](https://github.com/Rosettea/Hilbish/issues/198).
|
||||
|
||||
## [2.2.3] - 2024-04-27
|
||||
### Fixed
|
||||
|
|
|
@ -1,6 +1,3 @@
|
|||
> [!TIP]
|
||||
> Check out [Hilbish: Midnight Edition](https://github.com/Rosettea/Hilbish/tree/midnight-edition) if you want to use C Lua, LuaJIT or anything related!
|
||||
|
||||
<img src="./assets/hilbish-logo-and-text.png" width=512><br>
|
||||
<blockquote>
|
||||
🌓 The Moon-powered shell! A comfy and extensible shell for Lua fans! 🌺 ✨
|
||||
|
@ -39,7 +36,7 @@ on the website for distributed binaries from GitHub or other package repositorie
|
|||
Otherwise, continue reading for steps on compiling.
|
||||
|
||||
## Prerequisites
|
||||
- [Go 1.22+](https://go.dev)
|
||||
- [Go 1.17+](https://go.dev)
|
||||
- [Task](https://taskfile.dev/installation/) (**Go on the hyperlink here to see Task's install method for your OS.**)
|
||||
|
||||
## Build
|
||||
|
|
30
exec.go
30
exec.go
|
@ -8,7 +8,6 @@ import (
|
|||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
"os/signal"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"strings"
|
||||
|
@ -354,34 +353,7 @@ func execHandle(bg bool) interp.ExecHandlerFunc {
|
|||
sinks.Set(rt.StringValue("out"), rt.UserDataValue(stdout.ud))
|
||||
sinks.Set(rt.StringValue("err"), rt.UserDataValue(stderr.ud))
|
||||
|
||||
t := rt.NewThread(l)
|
||||
sig := make(chan os.Signal)
|
||||
exit := make(chan bool)
|
||||
|
||||
luaexitcode := rt.IntValue(63)
|
||||
var err error
|
||||
go func() {
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
exit <- true
|
||||
}
|
||||
}()
|
||||
|
||||
signal.Notify(sig, os.Interrupt)
|
||||
select {
|
||||
case <-sig:
|
||||
t.KillContext()
|
||||
return
|
||||
}
|
||||
|
||||
}()
|
||||
|
||||
go func() {
|
||||
luaexitcode, err = rt.Call1(t, rt.FunctionValue(cmd), rt.TableValue(luacmdArgs), rt.TableValue(sinks))
|
||||
exit <- true
|
||||
}()
|
||||
|
||||
<-exit
|
||||
luaexitcode, err := rt.Call1(l.MainThread(), rt.FunctionValue(cmd), rt.TableValue(luacmdArgs), rt.TableValue(sinks))
|
||||
if err != nil {
|
||||
fmt.Fprintln(os.Stderr, "Error in command:\n" + err.Error())
|
||||
return interp.NewExitStatus(1)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//go:build unix
|
||||
// +build linux darwin
|
||||
|
||||
package main
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//go:build windows
|
||||
// +build windows
|
||||
|
||||
package main
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//go:build windows
|
||||
// +build windows
|
||||
|
||||
package main
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//go:build unix
|
||||
// +build darwin linux
|
||||
|
||||
package main
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//go:build windows
|
||||
// +build windows
|
||||
|
||||
package main
|
||||
|
||||
|
|
9
main.go
9
main.go
|
@ -6,7 +6,6 @@ import (
|
|||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
"os/exec"
|
||||
"os/user"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
|
@ -116,13 +115,7 @@ func main() {
|
|||
|
||||
// Set $SHELL if the user wants to
|
||||
if *setshflag {
|
||||
os.Setenv("SHELL", "hilbish")
|
||||
|
||||
path, err := exec.LookPath("hilbish")
|
||||
if err == nil {
|
||||
os.Setenv("SHELL", path)
|
||||
}
|
||||
|
||||
os.Setenv("SHELL", os.Args[0])
|
||||
}
|
||||
|
||||
lr = newLineReader("", false)
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
local commander = require 'commander'
|
||||
|
||||
commander.register('exec', function(args)
|
||||
if #args == 0 then
|
||||
return
|
||||
end
|
||||
hilbish.exec(args[1])
|
||||
end)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//go:build unix
|
||||
// +build darwin linux
|
||||
|
||||
package main
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//go:build windows
|
||||
// +build windows
|
||||
|
||||
package main
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//go:build darwin
|
||||
// +build darwin
|
||||
|
||||
package main
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//go:build unix && !darwin
|
||||
// +build linux
|
||||
|
||||
package main
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
//go:build windows
|
||||
// +build windows
|
||||
|
||||
package main
|
||||
|
||||
|
|
Loading…
Reference in New Issue