Skip to content

Commit

Permalink
fix: properly quote edit command on Windows (#1279)
Browse files Browse the repository at this point in the history
Fixes #1068
  • Loading branch information
quintesse authored Mar 8, 2022
1 parent c8bcd40 commit 056ca3b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/main/java/dev/jbang/cli/Edit.java
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,11 @@ public Integer doCall() throws IOException {
optionList.add(projectPathString);

String[] cmd;
final String editorCommand = String.join(" ", escapeOSArguments(optionList, Util.getShell()));
if (Util.getShell() == Shell.bash) {
final String editorCommand = String.join(" ", escapeOSArguments(optionList, Shell.bash));
cmd = new String[] { "sh", "-c", editorCommand };
} else {
final String editorCommand = String.join(" ", escapeOSArguments(optionList, Shell.cmd));
cmd = new String[] { "cmd", "/c", editorCommand };
}
verboseMsg("Running `" + String.join(" ", cmd) + "`");
Expand Down

0 comments on commit 056ca3b

Please sign in to comment.