diff --git a/app/app.go b/app/app.go index 978d71a..031f35c 100644 --- a/app/app.go +++ b/app/app.go @@ -64,6 +64,7 @@ type Options struct { ReconnectTime int `hcl:"reconnect_time"` Once bool `hcl:"once"` PermitArguments bool `hcl:"permit_arguments"` + CloseSignal int `hcl:"close_signal"` Preferences HtermPrefernces `hcl:"preferences"` RawPreferences map[string]interface{} `hcl:"preferences"` } @@ -88,6 +89,7 @@ var DefaultOptions = Options{ EnableReconnect: false, ReconnectTime: 10, Once: false, + CloseSignal: 1, // syscall.SIGHUP Preferences: HtermPrefernces{}, } diff --git a/app/client_context.go b/app/client_context.go index aee31c3..d4c2f29 100644 --- a/app/client_context.go +++ b/app/client_context.go @@ -75,7 +75,7 @@ func (context *clientContext) goHandleClient() { // Even if the PTY has been closed, // Read(0 in processSend() keeps blocking and the process doen't exit - context.command.Process.Signal(syscall.SIGHUP) + context.command.Process.Signal(syscall.Signal(context.app.options.CloseSignal)) context.command.Wait() context.connection.Close() diff --git a/main.go b/main.go index 5e42465..20f3600 100644 --- a/main.go +++ b/main.go @@ -35,6 +35,7 @@ func main() { flag{"reconnect-time", "", "Time to reconnect"}, flag{"once", "", "Accept only one client and exit on disconnection"}, flag{"permit-arguments", "", "Permit clients to send command line arguments in URL (e.g. http://example.com:8080/?arg=AAA&arg=BBB)"}, + flag{"close-signal", "", "Signal sent to the command process when gotty close it (default: SIGHUP)"}, } mappingHint := map[string]string{