summaryrefslogtreecommitdiffstats
path: root/cmd_pid.go
blob: d7fd3fe22d2f4b8c733b1c2f6b89f51a8b40de53 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package goctl

import (
	"os"
	"strconv"
)

var pid string

type cmdPID struct{}

func (cmd cmdPID) Name() string {
	return "pid"
}

func (cmd cmdPID) Run(_ *Goctl, _ []string) string {
	return pid
}

func init() {
	pid = strconv.Itoa(os.Getpid())
	builtinHandlers = append(builtinHandlers, cmdPID{})
}