Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>Linux Sandbox RunnerNew to Visual Studio Code? Get it now.
Linux Sandbox Runner

Linux Sandbox Runner

dhaval314

|
23 installs
| (0) | Free
Run C++, Python, and Java code in a secure sandbox.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Linux Sandbox Runner

A lightweight, secure code runner designed for Competitive Programming on Linux.

This extension allows you to run C++, Python, and Java code in a sandboxed environment with strict Time Limits and Memory Limits. It automatically handles input redirection and output verification (Verdict System).

Features

  • Secure Sandbox: Runs your code in a child process with strict resource limits (CPU time & RAM) enforced via Linux setrlimit.
  • Enforce Limits: Automatically kills programs that exceed the time limit (TLE) or memory limit (MLE).
  • Input Redirection: Automatically detects input.txt in the same folder and pipes it to your program's standard input (stdin).
  • Automatic Verdicts: If an output.txt file exists, the extension compares your program's output against it and reports Accepted (AC) or Wrong Answer (WA).
  • Multi-Language Support:
    • C++: Compiles with g++ -O2 and runs the binary.
    • Python: Runs via /usr/bin/python3.
    • Java: Runs via /usr/bin/java.
  • Status Bar Integration: A handy Run Code button appears in the status bar when you open a supported file.

Requirements

This extension relies on Linux-specific APIs to enforce limits. It will not work on Windows or macOS.

  1. OS: Linux (Ubuntu, Fedora, Arch, WSL2, etc.)
  2. Compilers/Interpreters:
    • g++ (for C++ support)
    • python3 (for Python support)
    • java (for Java support)

To install g++ on Ubuntu/Debian:

sudo apt update
sudo apt install g++

Usage

  1. Open a .cpp, .py, or .java file in VS Code.
  2. (Optional) Create an input.txt file in the same folder to provide input.
  3. (Optional) Create an output.txt file in the same folder to test against expected output.
  4. Click the "Run Code" button in the bottom Status Bar (or press Ctrl+Alt+R).

The extension will compile (if necessary), run your code, and display the detailed results in the "Sandbox Result" output channel.

Extension Settings

You can configure global limits through VS Code Settings (Ctrl + ,).

  • sandbox.timeLimit: Execution time limit in seconds (Default: 2).
  • sandbox.memoryLimit: Memory limit in Megabytes (Default: 256).

Example Workflow

1. Write Code (test.cpp)

#include <iostream>
using namespace std;
int main() {
    int a, b;
    cin >> a >> b;
    cout << a + b;
    return 0;
}

2. Create Input (input.txt)

5 10

3. Create Expected Output (output.txt)

15

4. Run it! The extension will report:

Status: AC (Accepted) Time: 2ms Memory: 3400KB

Known Issues

  • WSL Users: Ensure you have the "Remote - WSL" extension installed and are opening the folder inside the WSL file system, not the Windows mount (/mnt/c/...).
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft