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
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.Oh, this is just what I need. THank you 🙂
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
You need to write the command you want run inside of the task in the mojoproject.toml/pixi.toml file.
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
Can you post the whole file?
If I had to guess, it's defaulting to pixi.toml.
Try removing that file.
You only need one of them.
Yes, using only mojoproject.toml works 🙂
Thank you so much