Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] command execution (--exec) not working as expected #1465

Closed
1 task done
notDavid opened this issue Jan 1, 2024 · 3 comments
Closed
1 task done

[BUG] command execution (--exec) not working as expected #1465

notDavid opened this issue Jan 1, 2024 · 3 comments
Labels

Comments

@notDavid
Copy link

notDavid commented Jan 1, 2024

Checks

  • I have read the troubleshooting section and still think this is a bug.

Describe the bug you encountered:

Hi there,

Noob here, probably a misunderstanding on my side, but not sure what i'm doing wrong, can someone please advise?

Thank you!

bsh ❯ tree
.
├── test1
│   ├── 1.txt
│   └── 2.txt
└── test2
    ├── 3.txt
    └── 4.txt

3 directories, 4 files

 ~/tmp/test
bsh ❯ fd --exec rm -i
remove ./test2/4.txt? remove ./test1/2.txt? remove ./test1/1.txt? rm: ./test2: is a directory
rm: ./test1: is a directory
remove ./test2/3.txt?

 ~/tmp/test
bsh ❯ tree
.
├── test1
│   ├── 1.txt
│   └── 2.txt
└── test2
    ├── 3.txt
    └── 4.txt

3 directories, 4 files

 ~/tmp/test
bsh ❯ fd --exec rm -irv
remove ./test2/4.txt? remove ./test2/3.txt? remove ./test1/2.txt? examine files in directory ./test1? remove ./test1/1.txt? examine files in directory ./test2?

 ~/tmp/test
bsh ❯ tree
.
├── test1
│   ├── 1.txt
│   └── 2.txt
└── test2
    ├── 3.txt
    └── 4.txt

3 directories, 4 files

Describe what you expected to happen:

I would expect rm to ask for confirmation to delete each file & folder, but it just spams all the output and does nothing...

What version of fd are you using?

fd 9.0.0

Which operating system / distribution are you on?

macOS 14.2.1
arm64
@notDavid notDavid added the bug label Jan 1, 2024
@notDavid
Copy link
Author

notDavid commented Jan 1, 2024

I expect what is needed is something like xargs option -o ? :

-o
Reopen stdin as /dev/tty in the child process before executing the command.
This is useful if you want xargs to run an interactive application.

@tavianator
Copy link
Collaborator

By default fd runs commands in parallel, so passing the input through to them would behave very weirdly. If you add -j1 it will work:

tavianator@graphene $ fd bar -j1 -x rm -i
rm: remove regular empty file './bar'? y

@notDavid
Copy link
Author

Thank you for explaining @tavianator 🙏🏼️ 👍🏼️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants