Skip to content

Commit 6ac8659

Browse files
committed
fix: rclone cat needs to pass through stdio
1 parent 913e58a commit 6ac8659

File tree

4 files changed

+12
-6
lines changed

4 files changed

+12
-6
lines changed

bin/rclone.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const rclone = require("../");
44

55
const [/** node **/, /** file **/, commandName, ...args] = process.argv;
66

7-
// "update" command is not a rclone command.
7+
// "update" is not a rclone command.
88
if (commandName === "update") {
99
return rclone.update(...args);
1010
}
@@ -14,10 +14,10 @@ const { [commandName]: command } = rclone;
1414

1515
const subprocess = command ? command(...args) : rclone(commandName, ...args);
1616

17-
subprocess.stdout.on("data", (data) => {
17+
subprocess.stdout?.on("data", (data) => {
1818
console.log(data.toString());
1919
});
2020

21-
subprocess.stderr.on("data", (data) => {
21+
subprocess.stderr?.on("data", (data) => {
2222
console.error(data.toString());
2323
});

index.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,17 @@ api.update = async function() {
7777
});
7878
}
7979

80+
// Rclone's `cat` needs to pipe directly to stdout.
81+
api.cat = function() {
82+
return spawn(RCLONE, ["cat", ...arguments], {
83+
stdio: "inherit",
84+
});
85+
}
86+
8087
const COMMANDS = [
8188
"about", // Get quota information from the remote.
8289
"authorize", // Remote authorization.
8390
"backend", // Run a backend specific command.
84-
"cat", // Concatenates any files and sends them to stdout.
8591
"check", // Checks the files in the source and destination match.
8692
"cleanup", // Clean up the remote if possible.
8793
"config", // Enter an interactive configuration session.

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "rclone.js",
3-
"version": "0.4.1",
3+
"version": "0.4.2",
44
"description": "JavaScript API for rclone",
55
"main": "index.js",
66
"bin": {

0 commit comments

Comments
 (0)