Closed akdor1154 closed 2 years ago
Currently, executable
literally means executable path only, without any arguments. I believe arguments did work before the current version, which largely reimplemented the code execution system but still has a few missing features. I need to either add some additional processing of executable
so that arguments work (probably something like shlex.split()
), or add a new option for arguments so that you can do something like args=...
.
sorta related if you end up looking at this - I tried to wrap my executor in a local script, but it looks like this doesn't work either (through no fault of your own)
```{.bash .cb-nb executor="./local.sh"}
echo hi
````markdown
``` {.error .sysConfigError}
SYS CONFIG ERROR in "post.md" near line 88:
Could not find executable "local.sh"
I think this is because of the (surprising to me) behvaiour of `Path.as_posix()` -
```python
import pathlib
p = pathlib.Path("./local.sh")
print(p.as_posix())
# "local.sh"
:(
The new dev version on GitHub adds a new setting executable_opts
. So now you should be able to do something like this (not sure if you need the /usr/bin/fish
for your setup):
```{.bash .cb-nb session=dock executable=podman executable_opts="run --name mine -v .:/demo -it ubuntu:21.10 /usr/bin/fish"}
set -e
cd /demo/demo
pwd
I've also changed the handling of `executable`, so things like `executable="./local.sh"` should work now.
Finally, I've added a new settings `args` for specifying command-line arguments that are passed to your code. Code execution now defaults to `{executable} {executable_opts} {source} {args}`, where `{source}` is a temp file containing the code from the code block.
Let me know if these new settings have any significant limitations for the sort of thing you are trying to do.
I'm working on a few unrelated features, and as soon as those are finished there will be a new release and a new version on PyPI, probably within a few days.
Woohoo, that looks pretty general to any situation! Ill have a play with the new release.
Hey, Thanks for this project, seems to nearly fill exactly what I was looking for.
I am getting stuck on one thing - I'm writing shell code cells, but I'm wanting to use a custom executable/shell for these. For this example let's say I want to use
/usr/bin/fish
, but full disclosure, what I really want is to get codebraid to run its stuff in a container, by passing the executablepodman run -it docker.io/ubuntu:21.10
.When passing
executable=
to the shell session block as per docs, I get an "executable not found" error: