Ctrl+c cant kill this program

I want to use rclone rc for mount a minio bucket

When I use the following code, It will work well.
But when I press ctrl+C, this procedure will not be killed.
I must press ctrl+C again, then this procedure will be killed.
Is it a bug? And how I press ctrl+C once to kill this procedure

package main

import (
	_ "github.com/rclone/rclone/backend/all" // import all backends
	_ "github.com/rclone/rclone/cmd/all"     // import all commands
	_ "github.com/rclone/rclone/lib/plugin"  // import plugins
	"github.com/rclone/rclone/librclone/gomobile"
	"os"
	"os/signal"
	"syscall"
)

func main() {
	var c = make(chan os.Signal)
	signal.Notify(c, os.Interrupt, os.Kill, syscall.SIGHUP)
	gomobile.RcloneRPC("config/create",
		// language=json
		`{
		"name": "minio",
		"type": "s3",
		"parameters": {
		"provider": "Minio",
		"access_key_id": "xxxx",
		"secret_access_key": "xxxx",
			"endpoint": "https://example.com"
		}
		}`)

	gomobile.RcloneRPC("mount/mount",
		// language=json
		`
				{
					"mountPoint": "Z:",
					"fs": "minio:/public"
				}
				`)
	<-c
}

I use windows 10 22H2, golang 1.21

Did you try removing this?

Yes, with or without this line of code, you can't just Ctrl+C to end the program.

And, thank you for your reply!

If you are using mount on Windows then WinFSP and its go library cgofuse intercept CTRL-C. What should happen is that they unmount the file system. Can you see if that happens? Maybe the file system is being unmounted but the library is running on!

Running with debug might make things clearer too.

emmm, When I press ctrl+C first, file system will be unmount from my disk, but after that, program will not be exit, I must press Ctrl+C again
Maybe Winfsp and cgofuse intercept CTRL-C, and how to solve it?

If I use rclone.exe directly, I just press CTRL+C once, it is a strange problem

rclone rcd --rc-no-auth

this problem is may be rclone rc

First, I use this command for mount

rclone rc mount/mount --json '{ "mountPoint": "Z:","fs": "minio:/public"}'

then I use this command for unmount

rclone rc mount/unmount --json '{"mountPoint": "Z:"}'

After that, I press ctrl+c to close rcd

rcd will not be exit, I must press ctrl+c again.
If I do this operations , rcd will print this log but not exit

The service rclone has been started.
2023/10/31 12:22:05 ERROR : Z:: Unmounted rclone mount
The service rclone has been stopped.

If i dont mount , rcd just press Ctrl+C once for exit

When you do that, try to get a list of active goroutines from

curl http://localhost:5572/debug/pprof/goroutine?debug=1

(or use your browser) and post the output here

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.