The `exec` action hangs when last argument is enclosed in double quotes
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 5.9k
- Forks
- 1.8k
- PR merge metrics
- No merged PRs in 30d
Description
Describe the bug
As part of a custom action I'm writing, I'm trying to use the exec action to run ripgrep in the following way:
rg --type rust --files-without-match --fixed-strings "Copyright (C) 2022 MaidSafe."
I'm attempting to do this using the exec action:
async function runRipGrep(searchString) {
let output = '';
const options = {};
options.listeners = {
stdout: (data) => {
output += data.toString();
}
};
await exec.exec(
'rg',
[
'--type', 'rust', '--files-without-match',
'--fixed-strings', `"${searchString}"`
],
options);
return output;
}
When exec runs as above, it hangs indefinitely until the workflow run is cancelled.
To Reproduce
Invoke rg using the mechanism above.
Expected behavior
The process should run and return its output.
Additional context
I tried different ways of running it. Curiously, if you add an additional argument after the double quotes enclosed argument, exec does return:
async function runRipGrep(searchString) {
let output = '';
const options = {};
options.listeners = {
stdout: (data) => {
output += data.toString();
}
};
await exec.exec(
'rg',
[
'--type', 'rust', '--files-without-match',
'--fixed-strings', `"${searchString}"`, '.'
],
options);
return output;
}
However, the process doesn't produce the same output as per executing it from the shell, which may suggest the double quotes are causing some sort of parsing issue. It's almost like the search string is not supplied.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the TypeScript toolkit's exec.exec entry point and reproduce the provided ripgrep invocation with the quoted final argument. Trace how the argument list is passed to the process, then verify that the command returns without hanging and produces the expected output when the quoted argument is last.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100