10BC0 Merge pull request #606 from filipw/bugfix/folder-with-whitespace · dotnet-script/dotnet-script@5472904 · GitHub
[go: up one dir, main page]

Skip to content

Commit 5472904

Browse files
authored
Merge pull request #606 from filipw/bugfix/folder-with-whitespace
Bugfix-Initialize folder with whitespace
2 parents 8772ac5 + d38a4c9 commit 5472904

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

src/Dotnet.Script.Core/Scaffolder.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public void CreateNewScriptFile(string fileName, string currentDirectory)
6363
RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
6464
{
6565
// mark .csx file as executable, this activates the shebang to run dotnet-script as interpreter
66-
_commandRunner.Execute($"/bin/chmod", $"+x {pathToScriptFile}");
66+
_commandRunner.Execute($"/bin/chmod", $"+x \"{pathToScriptFile}\"");
6767
}
6868
_scriptConsole.WriteSuccess($"...'{pathToScriptFile}' [Created]");
6969
}

src/Dotnet.Script.Tests/ScaffoldingTests.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,24 @@ public void ShouldInitializeScriptFolder()
3434
}
3535
}
3636

37+
[Fact]
38+
public void ShouldInitializeScriptFolderContainingWhitespace()
39+
{
40+
using (var scriptFolder = new DisposableFolder())
41+
{
42+
var path = Path.Combine(scriptFolder.Path, "Folder with whitespace");
43+
Directory.CreateDirectory(path);
44+
45+
var (output, exitCode) = ScriptTestRunner.Default.Execute("init", path);
46+
47+
Assert.Equal(0, exitCode);
48+
Assert.DoesNotContain("No such file or directory", output, StringComparison.OrdinalIgnoreCase);
49+
Assert.True(File.Exists(Path.Combine(path, "main.csx")));
50+
Assert.True(File.Exists(Path.Combine(path, "omnisharp.json")));
51+
Assert.True(File.Exists(Path.Combine(path, ".vscode", "launch.json")));
52+
}
53+
}
54+
3755
[OnlyOnUnixFact]
3856
public void ShouldRegisterToRunCsxScriptDirectly()
3957
{

0 commit comments

Comments
 (0)
0