新版本的 --remove-source 功能好像坏掉了 #59

Open
opened 2023-01-16 05:58:05 +00:00 by zeetex · 2 comments

v0.2.0-beta.2 版的 --remove-source 选项用不了,文件可以正常转换,但是报错说源文件被占用删不了。

$ um --remove-source .
2023/01/16 13:55:29.881 ERROR   um/main.go:168  conversion failed       {"source": "孙燕姿 - 充氧期.mflac", "error": "remove 孙燕姿 - 充氧期.mflac: The process cannot access the file because it is being used by another process."}
2023/01/16 13:55:30.106 ERROR   um/main.go:168  conversion failed       {"source": "孙燕姿 - 天天年年.mflac", "error": "remove 孙燕姿 - 天天年年.mflac: The process cannot access the file because it is being used by another process."}
2023/01/16 13:55:31.361 ERROR   um/main.go:168  conversion failed       {"source": "孙燕姿 - 天越亮,夜越黑.mflac", "error": "remove 孙燕姿 - 天越亮,夜越黑.mflac: The process cannot access the file because it is being used by another process."}
2023/01/16 13:55:32.814 ERROR   um/main.go:168  conversion failed       {"source": "孙燕姿 - 平日快乐.mflac", "error": "remove 孙燕姿 - 平日快乐.mflac: The process cannot access the file because it is being used by another process."}
2023/01/16 13:55:34.092 ERROR   um/main.go:168  conversion failed       {"source": "孙燕姿 - 我很愉快.mflac", "error": "remove 孙燕姿 - 我很愉快.mflac: The process cannot access the file because it is being used by another process."}
2023/01/16 13:55:35.068 ERROR   um/main.go:168  conversion failed       {"source": "孙燕姿 - 极美.mflac", "error": "remove 孙燕姿 - 极美.mflac: The process cannot access the file because it is being used by another process."}
2023/01/16 13:55:36.232 ERROR   um/main.go:168  conversion failed       {"source": "孙燕姿 - 超人类.mflac", "error": "remove 孙燕姿 - 超人类.mflac: The process cannot access the file because it is being used by another process."}
2023/01/16 13:55:37.217 ERROR   um/main.go:168  conversion failed       {"source": "孙燕姿 - 跳舞的梵谷.mflac", "error": "remove 孙燕姿 - 跳舞的梵谷.mflac: The process cannot access the file because it is being used by another process."}
2023/01/16 13:55:38.451 ERROR   um/main.go:168  conversion failed       {"source": "孙燕姿 - 风衣.mflac", "error": "remove 孙燕姿 - 风衣.mflac: The process cannot access the file because it is being used by another process."}
`v0.2.0-beta.2` 版的 `--remove-source` 选项用不了,文件可以正常转换,但是报错说源文件被占用删不了。 ``` $ um --remove-source . 2023/01/16 13:55:29.881 ERROR um/main.go:168 conversion failed {"source": "孙燕姿 - 充氧期.mflac", "error": "remove 孙燕姿 - 充氧期.mflac: The process cannot access the file because it is being used by another process."} 2023/01/16 13:55:30.106 ERROR um/main.go:168 conversion failed {"source": "孙燕姿 - 天天年年.mflac", "error": "remove 孙燕姿 - 天天年年.mflac: The process cannot access the file because it is being used by another process."} 2023/01/16 13:55:31.361 ERROR um/main.go:168 conversion failed {"source": "孙燕姿 - 天越亮,夜越黑.mflac", "error": "remove 孙燕姿 - 天越亮,夜越黑.mflac: The process cannot access the file because it is being used by another process."} 2023/01/16 13:55:32.814 ERROR um/main.go:168 conversion failed {"source": "孙燕姿 - 平日快乐.mflac", "error": "remove 孙燕姿 - 平日快乐.mflac: The process cannot access the file because it is being used by another process."} 2023/01/16 13:55:34.092 ERROR um/main.go:168 conversion failed {"source": "孙燕姿 - 我很愉快.mflac", "error": "remove 孙燕姿 - 我很愉快.mflac: The process cannot access the file because it is being used by another process."} 2023/01/16 13:55:35.068 ERROR um/main.go:168 conversion failed {"source": "孙燕姿 - 极美.mflac", "error": "remove 孙燕姿 - 极美.mflac: The process cannot access the file because it is being used by another process."} 2023/01/16 13:55:36.232 ERROR um/main.go:168 conversion failed {"source": "孙燕姿 - 超人类.mflac", "error": "remove 孙燕姿 - 超人类.mflac: The process cannot access the file because it is being used by another process."} 2023/01/16 13:55:37.217 ERROR um/main.go:168 conversion failed {"source": "孙燕姿 - 跳舞的梵谷.mflac", "error": "remove 孙燕姿 - 跳舞的梵谷.mflac: The process cannot access the file because it is being used by another process."} 2023/01/16 13:55:38.451 ERROR um/main.go:168 conversion failed {"source": "孙燕姿 - 风衣.mflac", "error": "remove 孙燕姿 - 风衣.mflac: The process cannot access the file because it is being used by another process."} ```
um-dev added the
bug
label 2023-01-18 02:07:59 +00:00
um-dev self-assigned this 2023-01-18 02:08:03 +00:00

同样遇到此问题,坐等修复

同样遇到此问题,坐等修复
// if source file need to be removed
	if p.removeSource {
		file.Close() //我加了一行,可以了
		err := os.RemoveAll(inputFile)
		if err != nil {
			return err
		}
		logger.Info("successfully converted, and source file is removed", zap.String("source", inputFile), zap.String("destination", outPath))
	} else {
		logger.Info("successfully converted", zap.String("source", inputFile), zap.String("destination", outPath))
	}
``` // if source file need to be removed if p.removeSource { file.Close() //我加了一行,可以了 err := os.RemoveAll(inputFile) if err != nil { return err } logger.Info("successfully converted, and source file is removed", zap.String("source", inputFile), zap.String("destination", outPath)) } else { logger.Info("successfully converted", zap.String("source", inputFile), zap.String("destination", outPath)) } ```
Sign in to join this conversation.
No description provided.