Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
haoqu.ma
/
gotty
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 45f8f611
authored
Aug 20, 2017
by
Iwasaki Yudai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix option handling of close signal
1 parent
56e9b891
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
6 deletions
backend/localcommand/factory.go
backend/localcommand/factory.go
View file @
45f8f61
...
...
@@ -2,6 +2,7 @@ package localcommand
import
(
"syscall"
"time"
"github.com/yudai/gotty/server"
)
...
...
@@ -15,13 +16,20 @@ type Factory struct {
command
string
argv
[]
string
options
*
Options
opts
[]
Option
}
func
NewFactory
(
command
string
,
argv
[]
string
,
options
*
Options
)
(
*
Factory
,
error
)
{
opts
:=
[]
Option
{
WithCloseSignal
(
syscall
.
Signal
(
options
.
CloseSignal
))}
if
options
.
CloseTimeout
>=
0
{
opts
=
append
(
opts
,
WithCloseTimeout
(
time
.
Duration
(
options
.
CloseTimeout
)
*
time
.
Second
))
}
return
&
Factory
{
command
:
command
,
argv
:
argv
,
options
:
options
,
opts
:
opts
,
},
nil
}
...
...
@@ -35,10 +43,6 @@ func (factory *Factory) New(params map[string][]string) (server.Slave, error) {
if
params
[
"arg"
]
!=
nil
&&
len
(
params
[
"arg"
])
>
0
{
argv
=
append
(
argv
,
params
[
"arg"
]
...
)
}
return
New
(
factory
.
command
,
argv
,
WithCloseSignal
(
syscall
.
Signal
(
factory
.
options
.
CloseSignal
)),
WithCloseSignal
(
syscall
.
Signal
(
factory
.
options
.
CloseTimeout
)),
)
return
New
(
factory
.
command
,
argv
,
factory
.
opts
...
)
}
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment