def test_glob_to_cmdrun_paths_with_spaces(runtime_cls, run_as_openhands, temp_dir):
    """Test paths with spaces and special characters for glob command."""
    runtime, config = _load_runtime(temp_dir, runtime_cls, run_as_openhands)
    try:
        # Create test directories with spaces and special characters
        setup_cmd = """
        mkdir -p "project files/src" "test results/unit tests" "weird$path/code" "path with spaces and $pecial ch@rs" && \
        touch "project files/src/file1.js" "project files/src/file2.js" && \
        touch "test results/unit tests/test1.js" "test results/unit tests/test2.js" && \
        touch "weird$path/code/weird1.js" "weird$path/code/weird2.js" && \
        touch "path with spaces and $pecial ch@rs/special1.js" "path with spaces and $pecial ch@rs/special2.js"
        """
        obs = _run_cmd_action(runtime, setup_cmd)
        assert obs.exit_code == 0, 'Failed to set up test files'

        special_paths = [
            'project files/src',
            'test results/unit tests',
        ]

        for path in special_paths:
            cmd = glob_to_cmdrun('*.js', path)

            # Execute the command
            obs = _run_cmd_action(runtime, cmd)
            assert obs.exit_code == 0, f'Glob command failed for path: {path}'

            # Verify expected files are found in each path
            if path == 'project files/src':
                assert 'file1.js' in obs.content
                assert 'file2.js' in obs.content
            elif path == 'test results/unit tests':
                assert 'test1.js' in obs.content
                assert 'test2.js' in obs.content
    finally:
        _close_test_runtime(runtime)
Test paths with spaces and special characters for glob command.
tests/runtime/test_glob_and_grep.py