use a3s_box_sdk::Sandbox;
#[tokio::main]
async fn main() -> Result<(), a3s_box_sdk::ClientError> {
let sandbox = Sandbox::create("alpine:3.20").await?;
let result = sandbox.commands.run("printf ready").await?;
println!("{}", result.stdout);
sandbox.kill().await?;
Ok(())
}
package main
import (
"context"
"fmt"
"log"
box "github.com/A3S-Lab/Box/sdk/go/v3"
)
func main() {
ctx := context.Background()
sandbox, err := box.Create(ctx, "alpine:3.20")
if err != nil {
log.Fatal(err)
}
defer sandbox.Close(context.Background())
result, err := sandbox.Run(ctx, box.Argv("printf", "ready"))
if err != nil {
log.Fatal(err)
}
fmt.Println(result.StdoutString())
}
import asyncio
from a3s_box import AsyncSandbox
async def main() -> None:
async with await AsyncSandbox.create("alpine:3.20") as sandbox:
result = await sandbox.commands.run("printf ready")
print(result.stdout)
if __name__ == "__main__":
asyncio.run(main())
import { Sandbox } from '@a3s-lab/box';
async function main(): Promise<void> {
const sandbox = await Sandbox.create('alpine:3.20');
try {
const result = await sandbox.commands.run('printf ready');
console.log(result.stdout);
} finally {
await sandbox.kill();
}
}
main().catch((error: unknown) => {
console.error(error);
process.exitCode = 1;
});