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

Evaluate $(...) in commands at run not at enqueue #31

Open
jasam-sheja opened this issue Nov 23, 2022 · 2 comments
Open

Evaluate $(...) in commands at run not at enqueue #31

jasam-sheja opened this issue Nov 23, 2022 · 2 comments
Labels
enhancement New feature or request

Comments

@jasam-sheja
Copy link

ts is such a great tool. Thanks for maintaining it.

I'm passing a port number to many jobs, and the port has to be free for the job to run correctly.
I have a script that finds a free port, and I use it to run the command using ts. i.e., ts -G 1 run --port=$(find_free_port).
The problem is doing it like above evaluates the script when the command is added to the queue!
Is there a way to evaluate it when ts runs the command?

@justanhduc
Copy link
Owner

Hey @jasam-sheja. Sorry for the belated reply. I can't think of a way for now, because any expansion escape will be passed literally to the shell command, which will eventually make it escape as well. It has to be implementation-defined. I will try to implement a solution soon!

@justanhduc justanhduc added the enhancement New feature or request label Nov 26, 2022
@Jasha10
Copy link
Contributor

Jasha10 commented Dec 29, 2022

@jasam-sheja how about this:

ts -G 1 bash -c 'run --port=$(find_free_port)'

The idea is for ts to launch a bash process, and then bash will call run and find the free port. Using the single quotes '', the shell expansion will happen in the child bash process instead of in the parent process.

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

No branches or pull requests

3 participants