From ef15f8e98603633928511de53ab41994d6714780 Mon Sep 17 00:00:00 2001
From: Ajinkya Udgirkar <ajinkyaudgirkar@gmail.com>
Date: Thu, 14 Dec 2023 18:05:17 +0530
Subject: [PATCH] Handle spaces in file path (#1032)

---
 src/features/runner.ts | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/features/runner.ts b/src/features/runner.ts
index 58c0cab45..feddd42f1 100644
--- a/src/features/runner.ts
+++ b/src/features/runner.ts
@@ -144,7 +144,8 @@ export class AnsiblePlaybookRunProvider {
       );
       return;
     }
-    commandLineArgs.push(playbookFsPath);
+    // replace spaces in file name with escape sequence '\ '
+    commandLineArgs.push(playbookFsPath.replace(/(\s)/, "\\ "));
     const cmdArgs = commandLineArgs.map((arg) => arg).join(" ");
     const [command, runEnv] = withInterpreter(
       this.settings,