M
Modular•3d ago
betrayaa

One liner to open "magic shell" + "magic build"

I am having issues with the magic. I want to programmatically and directly pipe build command into it. But I just loose my TTY. I tried a bunch of things but does not get it to work. Doing these commands manually might be alright when there is not much to be built but I would really like to know if you guys have a solution for this.
9 Replies
Darkmatter
Darkmatter•3d ago
You can make "tasks" whick run shell commands inside of the magic shell and use magic run $TASK to execute them. Nobody wants to deal with entering virtual environments in a CI pipeline or similar automated build environments, so this is the recommended solution. If you need more than fits in a single line, you can execute a bash script to run whatever you need.
betrayaa
betrayaaOP•3d ago
Oh, this is just what I need. THank you 🙂
betrayaa
betrayaaOP•3d ago
I am not getting it to work. I can run normal shell commands and scripts. But when I try to do "mojo build test.mojo" it does not recognize mojo like it is being run outside magic shell
Darkmatter
Darkmatter•3d ago
You need to write the command you want run inside of the task in the mojoproject.toml/pixi.toml file.
betrayaa
betrayaaOP•3d ago
Yes, that is what I tried to do: [tasks] build = "mojo build /home/magic_user/app/src/test.mojo" magic run build mojo: command not found Available tasks: build
Darkmatter
Darkmatter•3d ago
Can you post the whole file?
Darkmatter
Darkmatter•3d ago
If I had to guess, it's defaulting to pixi.toml. Try removing that file. You only need one of them.
betrayaa
betrayaaOP•3d ago
Yes, using only mojoproject.toml works 🙂 Thank you so much
Want results from more Discord servers?
Add your server