File size: 463 Bytes
76f9669
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

import sys

IS_WINDOWS = sys.platform == "win32"


def quote_for_shell(s: str) -> str:
    if IS_WINDOWS:
        # This is a relatively heavy import; keep pathfinder lean if possible.
        from subprocess import list2cmdline

        return list2cmdline([s])
    else:
        import shlex

        return shlex.quote(s)