tarantool / tarantool/tarantool

popen: add cwd run option

Open
#5,633 0 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature popen
Dominant language
Lua
Stars
3.7k
Forks
419
Avg merge
1d 23h
Merged PRs (30d)
88

Description

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 })

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the popen.new entry point and inspect how its command options are handled, using the existing fio.cwd and fio.chdir examples for context. The work is done when popen.new accepts cwd and runs the external command in that directory without requiring the caller to change the process working directory.

Written by the indexing model from the issue text.

Assessment

Tech stack
lua
Domain
backend
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.