Skip to content

Commit 6486e01

Browse files
author
mirkobrombin
committed
feat: Add support for creating shims for host binaries
1 parent 1f9ff38 commit 6486e01

2 files changed

Lines changed: 11 additions & 4 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,6 @@ problem on those systems where Flatpak or DBus are not available.
3737
## What is left to do?
3838

3939
- [ ] Add an option to restrict the commands that can be run
40-
- [ ] Add support for creating shims for host binaries
40+
- [x] Add support for creating shims for host binaries
4141
- [ ] Switch from TCP to Unix sockets
4242
- [ ] Code optimization

main.go

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010
"os"
1111
"os/exec"
1212
"os/signal"
13+
"path"
1314
"strconv"
1415
"strings"
1516
"syscall"
@@ -41,9 +42,15 @@ shell on the host.`)
4142
return
4243
}
4344

44-
command := []string{"sh", "-c", os.Getenv("SHELL")}
45-
if len(os.Args) > 1 {
46-
command = os.Args[1:]
45+
// Start the client otherwise
46+
var command []string
47+
if path.Base(os.Args[0]) == "hrun" {
48+
command = []string{"sh", "-c", os.Getenv("SHELL")}
49+
if len(os.Args) > 1 {
50+
command = os.Args[1:]
51+
}
52+
} else {
53+
command = append([]string{path.Base(os.Args[0])}, os.Args[1:]...)
4754
}
4855

4956
startClient(command)

0 commit comments

Comments
 (0)