mirror of
https://github.com/rclone/rclone.git
synced 2025-01-13 20:38:12 +02:00
rc: new call rc/pid - closes #2211
This commit is contained in:
parent
05e32cfcf9
commit
92b266d361
@ -118,6 +118,11 @@ check that parameter passing is working properly.
|
||||
This returns an error with the input as part of its error string.
|
||||
Useful for testing error handling.
|
||||
|
||||
### rc/pid: Return PID of current process
|
||||
|
||||
This returns PID of current process.
|
||||
Useful for stopping rclone process.
|
||||
|
||||
### rc/list: List all the registered remote control commands
|
||||
|
||||
This lists all the registered remote control commands as a JSON map in
|
||||
|
@ -2,7 +2,11 @@
|
||||
|
||||
package rc
|
||||
|
||||
import "github.com/pkg/errors"
|
||||
import (
|
||||
"os"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
func init() {
|
||||
Add(Call{
|
||||
@ -30,6 +34,14 @@ Useful for testing error handling.`,
|
||||
This lists all the registered remote control commands as a JSON map in
|
||||
the commands response.`,
|
||||
})
|
||||
Add(Call{
|
||||
Path: "rc/pid",
|
||||
Fn: rcPid,
|
||||
Title: "Return PID of current process",
|
||||
Help: `
|
||||
This returns PID of current process.
|
||||
Useful for stopping rclone process.`,
|
||||
})
|
||||
}
|
||||
|
||||
// Echo the input to the ouput parameters
|
||||
@ -48,3 +60,10 @@ func rcList(in Params) (out Params, err error) {
|
||||
out["commands"] = registry.list()
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// Return PID of current process
|
||||
func rcPid(in Params) (out Params, err error) {
|
||||
out = make(Params)
|
||||
out["pid"] = os.Getpid()
|
||||
return out, nil
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user