diff options
Diffstat (limited to 'cmd_pid.go')
-rw-r--r-- | cmd_pid.go | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/cmd_pid.go b/cmd_pid.go new file mode 100644 index 0000000..00f127f --- /dev/null +++ b/cmd_pid.go @@ -0,0 +1,23 @@ +package goctl + +import ( + "os" + "strconv" +) + +var pid string + +type cmdPID struct{} + +func (cmd cmdPID) Name() string { + return "pid" +} + +func (cmd cmdPID) Run(_ []string) string { + return pid +} + +func init() { + pid = strconv.Itoa(os.Getpid()) + builtinHandlers = append(builtinHandlers, cmdPID{}) +} |