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

popen: add cwd run option #5633

Open
koshoi opened this issue Dec 16, 2020 · 0 comments
Open

popen: add cwd run option #5633

koshoi opened this issue Dec 16, 2020 · 0 comments
Labels
feature A new functionality popen
Milestone

Comments

@koshoi
Copy link

koshoi commented Dec 16, 2020

Sometimes it is required to run external command in a specific directory. At this moment it is required to do something like this

local cwd = fio.cwd()
fio.chdir(path)
pcall(popen.new, { cmd })
fio.chdir(cwd)

or if you are running with shell flag it could be done with less code

cmd = string.format('cd %s && %s', path, cmd)
popen.new({ cmd }, { shell = true })

Would be nice to have cwd option so it all would look like this

popen.new({ cmd }, { cwd = path })
@koshoi koshoi added feature A new functionality popen labels Dec 16, 2020
@kyukhin kyukhin added this to the wishlist milestone Jul 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature A new functionality popen
Projects
None yet
Development

No branches or pull requests

2 participants