aboutsummaryrefslogtreecommitdiffhomepage
path: root/helper/args.go
diff options
context:
space:
mode:
authorOphestra Umiker <cat@ophivana.moe>2024-10-07 12:48:20 +0900
committerOphestra Umiker <cat@ophivana.moe>2024-10-07 12:48:20 +0900
commit9647eb6a6b5607e9aac1e2c113e80f2e966ec0ac (patch)
tree2f314f8669742a817df0057ceab79891b36bea9d /helper/args.go
parent18d9ce733e19c500ca04b4e744e6cdc5c6faf137 (diff)
helper: separate pipes from Helper
Upcoming bwrap helper implementation requires two sets of pipes to be managed, fd will also no longer be constant. Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
Diffstat (limited to 'helper/args.go')
-rw-r--r--helper/args.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/helper/args.go b/helper/args.go
index b06cc2ee..c841fd36 100644
--- a/helper/args.go
+++ b/helper/args.go
@@ -10,11 +10,11 @@ var (
ErrContainsNull = errors.New("argument contains null character")
)
-type argsFD []string
+type argsWt []string
// checks whether any element contains the null character
// must be called before args use and args must not be modified after call
-func (a argsFD) check() error {
+func (a argsWt) check() error {
for _, arg := range a {
for _, b := range arg {
if b == '\x00' {
@@ -26,7 +26,7 @@ func (a argsFD) check() error {
return nil
}
-func (a argsFD) WriteTo(w io.Writer) (int64, error) {
+func (a argsWt) WriteTo(w io.Writer) (int64, error) {
// assuming already checked
nt := 0
@@ -43,13 +43,13 @@ func (a argsFD) WriteTo(w io.Writer) (int64, error) {
return int64(nt), nil
}
-func (a argsFD) String() string {
+func (a argsWt) String() string {
return strings.Join(a, " ")
}
// NewCheckedArgs returns a checked argument writer for args.
// Callers must not retain any references to args.
func NewCheckedArgs(args []string) (io.WriterTo, error) {
- a := argsFD(args)
+ a := argsWt(args)
return a, a.check()
}