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

Forward stdin #1235

Open
marvinroger opened this issue May 13, 2022 · 19 comments
Open

Forward stdin #1235

marvinroger opened this issue May 13, 2022 · 19 comments
Assignees
Labels
linear: turbo Issues to sync to Linear for Turborepo team owned-by: turborepo

Comments

@marvinroger
Copy link

marvinroger commented May 13, 2022

Describe the feature you'd like to request

Hi!

I have a pretty standard setup, where I have a dev script running nodemon. nodemon allows to type a special rs command to stdin, triggering a restart of the process, which is very useful.

It works fine when ran directly, but it does not work through turbo, as turbo does not forward stdin to the underlying process.

Describe the solution you'd like

Maybe a task definition in turbo.json could have a forwardStdin option, which would, when enabled, forward stdin!
I think forwardStdin: true should be mutually exclusive with cache: true, because stdin could impact the result of the task.

TURBO-588

@MohamedLamineAllal
Copy link

MohamedLamineAllal commented Sep 22, 2022

I went and made pnpm run publish with a turbo publish pipline. And i was using 2FA. And providing ota code is necessary. And that doesn't work. No interactive processes support. Sure in my case the better workflow is to use changsets. But it was just an experiment out of curiosity. And this means that any kind of workflow that needs some kind of interactivity, wouldn't be possible. And anything like that wouldn't benefit from turbo cache mechanism.

@gsoltis
Copy link
Contributor

gsoltis commented Sep 23, 2022

forwardStdin is an interesting idea. I think it would have scheduling implications as well, only one task at a time would be able to grab it

@Azarattum
Copy link

Are there any workarounds for this? Something like this would be nice:

{
  "$schema": "https://turborepo.org/schema.json",
  "pipeline": { /* ... */ },
  "stdin": "web" // Package ID to forward stdin to
}

It would also eliminate any uncertainties, since we are able to pass only one package at a time.

@MyNameReallySux
Copy link

Any input on the priority/interest in this from the Vercel team? Any major engineering blockers?

It seems like this would be possible without too much complexity as long as --concurrency=1 and --cache=false. This is something I would attempt to fix, but not too awesome at Rust 😞. If someone can give me a quick pointer as to where this code would need to be implemented in the repo, I may attempt to fix in the future when I get some time.

@gsoltis
Copy link
Contributor

gsoltis commented Jan 28, 2023

I think if we're going to do this, we would need to have the restrictions you mention (--concurrency=1 and --cache=false or set to false in turbo.json) which amounts to: 1 task at a time, and don't write to the cache. I think we can eventually relax these restrictions, but doing so has implementation and scheduling concerns. Namely, what to do with two potentially-concurrent tasks that both want stdin. But we don't have to tackle that to get something out.

So that brings us to the syntax. I think the proposal for adding forwardStdin: true to the task in turbo.json would work, since it's a property of the task being run.

@dgarciamuria
Copy link

Today I run into an use case in which maybe having cache: true as optional would be helpful. In our workflow we leverage git-secret to store encrypted secrets and sometimes you get asked for the passphrase to decrypt them, but the password it self wont change the output of the command, it either runs or fails. Does it make sense?

@macseem
Copy link

macseem commented Apr 5, 2023

Yeah, this would be super helpful,
as cases like running react native app with dependencies makes you not being able to use "metro" commands

@appleseed-iii
Copy link

another use case is for a turbo command which runs prisma db push, which sometimes has interactive output like To apply this change we need to reset the database, do you want to continue? All data will be lost. › (y/N)

@thedevdavid
Copy link

another use case is Prisma migrations. After running prisma migrate dev with Turbo, I saw the successful migrations log and then nothing happened, the CLI was just hanging. Then a couple of mins later I realized that it was probably waiting for input but it couldn't go through Turbo and yep I was right.

After ctrl+c exiting the command, I was able to see the last line Enter a name for the new migration:

@clickclickonsal
Copy link

Another use case is with expo when running expo start. 🙇🏼

@mctrafik
Copy link

Not being able to run generators, builders, surveys etc feels like a deal-breaker. I'm investigating monorepo tools and for comparison, other tools do not suffer this obvious limitation!

@auvansang
Copy link

I am using turbo repos with expo and I can not enter r in the command line to refresh the bundle while development, please fix it

@mehulkar mehulkar self-assigned this Dec 12, 2023
@mehulkar mehulkar added the linear: turbo Issues to sync to Linear for Turborepo team label Dec 12, 2023
@federicobadini
Copy link

As mentioned in a linked shopify cli issue also the shopify dev command seems to have issues with turbo

@MickL
Copy link

MickL commented Feb 20, 2024

Drizzle is also unusable without this :/

@EduardoSimon
Copy link

I'm having the same issue when running jest in --watch mode.

@flogy
Copy link

flogy commented Feb 26, 2024

Would be interested in this feature too, to forward commands to Metro in React Native projects.

@garrettparris
Copy link

graph protocol / graph nodes unusable without this

@MickL
Copy link

MickL commented Apr 3, 2024

Hey guys, two weeks ago Turborepo released a new Teminal UI. This seems to be the solution or not?

Unfortunately there was no reporting back in this issue, @chris-olszewski @mehulkar could you give us an update?

I tried it and it seems to work, but the console output is cut off so I cant see what I am doing:
Bildschirmfoto 2024-04-03 um 21 48 12

Also it bothers me that when I only have on task running (which is common e.g. for Drizzle) it still shows this task UI and I need to jump into the task with enter key. Instead Turbo could notice I am executing just one task and just show me the output of this task with nothing around it.

@anthonyshew
Copy link
Contributor

To update here, @MickL is correct that our current plan is to enable this with the new terminal UI.

If you'd like to try out the new UI and have feedback, please add it to the RFC: #7802

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
linear: turbo Issues to sync to Linear for Turborepo team owned-by: turborepo
Projects
None yet
Development

No branches or pull requests