Skip to content

Commit 14bf6c5

Browse files
authored
fix: actor set-value with stdin input (#755)
1 parent 521a184 commit 14bf6c5

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

src/commands/actor/set-value.ts

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ export class SetValueCommand extends ApifyCommand<typeof SetValueCommand> {
1616
key: Args.string({
1717
required: true,
1818
description: 'Key of the record in key-value store.',
19+
ignoreStdin: true,
1920
}),
2021
value: Args.string({
2122
required: false,
@@ -24,6 +25,7 @@ export class SetValueCommand extends ApifyCommand<typeof SetValueCommand> {
2425
'- If empty, the record in the key-value store is deleted.\n' +
2526
'- If no `contentType` flag is specified, value is expected to be any JSON string value.\n' +
2627
'- If options.contentType is set, value is taken as is.',
28+
ignoreStdin: true,
2729
}),
2830
};
2931

@@ -35,21 +37,12 @@ export class SetValueCommand extends ApifyCommand<typeof SetValueCommand> {
3537
}),
3638
};
3739

38-
private stdin?: typeof process.stdin;
39-
40-
override async init() {
41-
await super.init();
42-
// Read data from stdin of the command
43-
this.stdin = process.stdin;
44-
}
45-
4640
async run() {
47-
const { stdin } = this;
4841
const { key, value } = this.args;
4942
const { contentType = 'application/json; charset=utf-8' } = this.flags;
5043

5144
// NOTE: If user pass value as argument and data on stdin same time. We use the value from argument.
52-
const recordValue = value || stdin;
45+
const recordValue = value || process.stdin;
5346
const apifyClient = await getApifyStorageClient();
5447
const storeClient = apifyClient.keyValueStore(getDefaultStorageId(APIFY_STORAGE_TYPES.KEY_VALUE_STORE));
5548

0 commit comments

Comments
 (0)